I'm not sure what is wrong with your code (haven't really looked yet). If all you want to do is convert a number to a string you could do the following:
Code:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main() {
int num;
char buffer[256];
string str = "";
cout << "Input num!\n>";
cin >> num;
str = itoa(num,buffer,10);
cout << endl << str << endl << num << endl;
system("pause");
return 0;
}
I had to create a temporary buffer because the itoa() function wants one, i'm not sure if you can use it directly with the string class or not. I couldn't find a way to get it to work. I'm sure somebody else may have the answer to that one.
James