C++ — Convert int to string
In order to convert an int (or any other numeric type, e.g., float,double, etc.) to string, you can use:
#include <sstream>
int i = 5;
std::string s;
std::stringstream out;
out << i;
s = out.str();
Other C/C++ not so frequently asked questions.
댓글