c++ - Appending a number to a number? -


how cold following:

say have number 10 , append number 317 it. resulting integer 10317. how can done. also, once have number, how example remove 17 off end. without using strings, , without obvious solving , adding.

thanks

this append both numbers

int append_a_and_b_as_int(int a, int b) {     for(int tmp = b; tmp > 0; tmp % 10)     {         *= 10;     }     return + b; } 

this rid of last n numbers

int remove_n_numbers_from_a(int n, int a) {     for(int = 0; < n; i++)     {         /= 10;     }     return a; } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -