void FunctionChar_Line() { int digit, k = 0, i=0; cin >> digit; int a = digit; while (a > 0) { a = a / 10; k++; } vector <char> string (k+1); while (i != k) { while (digit > 0) { int mod = digit % 10; digit = digit / 10; string[i] = mod; i++; } } i = 0; while (string[i] != '\0') { cout << string[i]; i++; } } Implementing the conversion of numbers to strings does not work. I think the problem is with the wrong array creation. Tell me how best to create an array for the string.