Home c++ int Translate to String

int Translate to String

Author

Date

Category

There is a variable:

int a = 5;

Need to make 5 transferred to the string

string c = int a;

just does not work so much, and how to do to work if you can do


Answer 1, Authority 100%

functions for converting numerical types in strings

# include & lt; iostream & gt;
INT MAIN ()
{
  int a;
  STD :: CIN & GT; & GT; a;
  STD :: String Str;
  str = std :: to_string (a); // Conversion from number to the string
  STD :: COUT & LT; & LT; STR & LT; & lt; STD :: ENDL;
  Return 0;
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions