Good question. Just google it. I have found a lot answers for this.
How to convert integer to string in C/C++?{Try to tell in ANSI GCC, but TC command would also do}?
Here's one in C++:
#include %26lt;iostream%26gt;
#include %26lt;string%26gt;
using namespace std;
int main()
{
char userInput[32];
string str;
cin.getline(userInput, 32);
for (int i = 0; i %26lt; 32; ++i)
{
str.push_back(userInput[i]);
}
cout %26lt;%26lt; str;
system("PAUSE");
return 0;
}
I haven't tested this so if it doesn't work, feel free to contact me.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment