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)
string number_to_string(int x) { if (!x) return "0"; string s, s2; while(x) { s.push_back(x%10 + '0'); x /= 10; } reverse(s.begin(), s.end()); return s; }