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)
namespace std { inline string to_string(int _Val) { // Convert long long to string char _Buf[2 * _MAX_INT_DIG]; snprintf(_Buf, "%d", _Val); return (string(_Buf)); } }
You can now use to_string(5).
to_string(5)