Converting Numbers to Strings C++

Converting Numbers to Strings
Instead of writing your own function to convert an integer or float to a string, just use the C++ class stringstream (in the sstream header).

In C++:


#include
#include
#include
using namespace std;

void itoa(int num, string & result)
{
stringstream converter;
converter << result=" converter.str();">

No comments: