What is the easiest way to convert from int to equivalent string in C++. I am aware of two methods. Is there any easier way?
int
string
(1)
Here's another easy way to do
char str[100]; sprintf(str, "%d", 101); string s = str;
sprintf is a well-known one to insert any data into a string of the required format.
sprintf
You can convert a char * array to a string as shown in the third line.
char *