hi all members
i would like to know how to convert int to char? can any tell me?
this is what i did is it rite?
basically im trying to print 0 infront of the number if it is a single digit.
example if i input 1 it will print 01 on the console window. is this the rite way of doing it? or is there another way of doin it?
thanks for replying and helping me!!cheers~~
regrads andrew
i would like to know how to convert int to char? can any tell me?
this is what i did is it rite?
Code:
#include <iostream.h> int main() { int num; char conv; cout<<"Enter the number range between 0-9"<<endl; cin>>num; switch(num) { case 1: { conv = 01; num = conv; break; } case 2: case 3: case 4: case 5: { cout<<"number"; break; } default: { cout<<"number"; break; } } cout<<num; return 0; }
example if i input 1 it will print 01 on the console window. is this the rite way of doing it? or is there another way of doin it?
thanks for replying and helping me!!cheers~~
regrads andrew
Comment