c++ - Convert integer to array -
I want to convert an integer into an array, so that it looks like the following:
< Pre> integer number = 123456; Int array [7]; With the result: array [0] = 1 array [1] = 2 ... array [6] = 6
Perhaps the better solution is to work back:
123456% 10 = 6
123456/10 = 12345
12345% 10 = 5
12345/10 = 1234
Comments
Post a Comment