Ok i got a simple question
how do you change a int to char
Ok i got a simple question
how do you change a int to char
itoa()
search MSDN for it
Do you mean a string -- a C++ string?Originally Posted by Afan
FAQ > How do I... (Level 1) > Convert a string to a int (C++)
sprintf is standard (or stringstreams).Originally Posted by h_howee
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
typecasting if u did want int to char
I don't know if it's proper, but I like stringstream. Something like this:
Code:#include <sstream> int x = 3; std::stringstream s; //streams x into the string s << x; //function to call s is s.str() cout<< s.str();
Last edited by IdioticCreation; 11-27-2006 at 10:14 PM.
Originally Posted by h_howeec:\Documents and Settings\David Brotz\My Documents\Visual Studio Projects\MathChecker 2.0\MathChecker 2.0Dlg.cpp(22): error C2143: syntax error : missing ';' before '.'Code:itoa(Value, Combo01_String*, 10);
For the FAQ one, i dont really understand how it converts so id rather do something i understand.
Is that a type and not a value? Why not sprintf?Originally Posted by Afan
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
maybe you should go with sprintf instead. Daves a better at this than i am
Program on an eight bit platform. int and char should be the same there.
There I would especially doubt it.Originally Posted by citizen
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*