Hi,
e.g.
int a = 20;
int b = 07;
I want to joint a and b together to get 2007.
Anybody know how to do it?
lots of help,
ken js
Printable View
Hi,
e.g.
int a = 20;
int b = 07;
I want to joint a and b together to get 2007.
Anybody know how to do it?
lots of help,
ken js
Like multiplying a by 100 perhaps?
Not very generic. I think what you want is to convert both to strings and concatenate them. As in:
Code:std::ostringstream str;
str << a << b;
std::cout << str.str() << std::endl;
Or the answers on other forums - enjoy the variety in the answers.
It always amazes me how easy it is to overlook these things.
Or, the convoluted way:
Output 20,0,7 to a txt. file(app), close, reopen the file then retrieve as a string.