I want to transform a number into a vector of it's digits. For example, 123 will be 1 2 3.
I came up with this code:
My question is, is there better way to do this? taking x and divide then multiply by 10 is a bit irksome for me.Code:
void transform(const uint & x , deque<uint> & output)
if ( x != 0 )
uint x_stripped = (x/10)*10;
uint digit = x - x_stripped;
transform(x_stripped / 10, output);