Concatenate int values

I needed to combine the values of 2 integers without performing any arithmetic on them.

Easily solved this way:

int n1 = 10;
int n2 = 90;
stringstream ss;
ss << n1 << n2;
ss >> n3;

The value of n3 in this instance will be 1090.



© 2009 Jeremiah Altepeter

Valid XHTML 1.0 Strict! Valid CSS!
Made with Notepad++ Powered by Wordpress Hosted with 1&1 Get Chrome