Contact: aviboots(AT)netvision.net.il
43,970 questions
57,412 answers
573 users
#include <iostream> unsigned concatenate(unsigned x, unsigned y) { unsigned pow = 10; while(y >= pow) pow *= 10; return x * pow + y; } int main(void) { int a = 12, b = 938; a = concatenate(a, b); std::cout << a; } /* run: 12938 */
#include <iostream> int main(void) { int a = 12, b = 938; std::string str1 = std::to_string(a); std::string str2 = std::to_string(b); str1 += str2; a = std::stoi(str1); std::cout << str1; } /* run: 12938 */