how to convert a number into word using cpp
Conversion from number to string or char* type
Collapse
X
-
-
-
Originally posted by iWillLiveforeve rwait do you mean an int into a char.
if so check out atoi()
You can also use a string stream:
[code=cpp]
#include <sstream>
int num = 65;
string numstr;
stringstream ss;
ss << num;
ss >> numstr;
cout << numstr << endl;
[/code]Comment
-
oops sorry I got confused between them I havent used them in a while.
besides i usually do sprintf with a buffer to convert the two but most people find that way harder.Comment
-
Originally posted by sicarieNext time, please read and follow the Posting Guidelines.Comment
-
I was speaking to the OP. Its not a big deal this time, but it would have been easy for the OP to put that into Google and get the answer, or even this site as I know we have answered this question before. And with larger questions (once again why its not incredibly important in this case) its nice to have the code the OP used, or the methodology of how they are going about it.
Edit:: I have changed the thread title to better describe the issue, and hopefully allow more people to either comment, or find an answer to a similar question (also in the Posting Guidelines ;)Comment
Comment