Hi,
I was wondering if someone could just give me a quick run down of how you convert datatypes to other datatypes in C++.
For example, how would I convert an int value to a string value?
Any help would be appreciated..
Dan
Printable View
Hi,
I was wondering if someone could just give me a quick run down of how you convert datatypes to other datatypes in C++.
For example, how would I convert an int value to a string value?
Any help would be appreciated..
Dan
For the basic types, you can cast between them:
For a string, use:Code:long val;
int other = 2;
val = (long)other;
Code:char buf[40];
int num = 50;
int radix = 10; // number base
itoa(num, buf, radix);