This code converts an integer to a string:
int someint=1;
ostringstream buffer;
buffer << someint;
string somestr = buffer.str();
// somestr now contains someint as a string!
This piece of code needs inclusion of sstream and of course string too:
#include <string>
#include <sstream>