#include <iostream> #include <cstdio> using namespace std; void change(char *str, int &count); bool symbol(char *str, char ch); int main() { setlocale(LC_ALL, "RUSSIAN"); char str[100] = "#rkt:# afet:rk: faktrlaa:etqg"; //набор символов. int count = 0; //счётчик элементов. cout << str << endl; change(str, count); cout << str << ' ' << '\n' << "Количество замен: " << count << endl; return 0; } void change(char *str, int &count) { do { while (*str++) { if (*str == ':') { char temp = *str; *str = *(str + 1); *(str + 1) = temp; } } } while (*str); } Question 1st. How to make the do while loop work several times. In my case, there is a shift by 1 element. As I understand it, instead of while (* str) you need to write something else, as I understand it while (* str) is a condition. Question 2nd. How to count the number of characters ':' in the same function. Variable count declared as a link, is this correct?