There is a variable:

int a = 5; 

you need to make 5 translated to string

 string c = int a; 

only it does not work, but how to make it work, if it can be done at all

  • Of course, you can even more so in C ++. But I can’t say precisely because I don’t use C. In Java, this is done by String.valueOf (a) or a.toString (). Look at the methods and do not rush to ask a question. I am a hundred percent sure that you would find the answer in Google - user8978194
  • с = to_string(a); - Harry

1 answer 1

Functions for converting numeric types to strings

 #include <iostream> int main() { int a; std::cin >> a; std::string str; str = std::to_string(a); //преобразование из числа в строку std::cout << str << std::endl; return 0; }