I am trying to figure out how to convert a integer to a string. I've been told there is a function to do this. If anyone can help that would be great.
Thanks
Shane
I am trying to figure out how to convert a integer to a string. I've been told there is a function to do this. If anyone can help that would be great.
Thanks
Shane
There are several ways to convert an integer to a string. One common C++ way to do it is using stringstreams:Code:#include <iostream> #include <string> #include <sstream> int main() { int i = 10; std::ostringstream theStream; theStream << i << " + " << 5 << " = " << i+5; std::string theString = theStream.str(); std::cout << theString << std::endl; }
Thanks alot for the help!!! I will let you know how it works out.
Thanks
Shane