How can I split an int in c++ to its single numbers? For example, I\'d like to split 23 to 2 and 3.
Given the number 12345 :
5 is 12345 % 10 4 is 12345 / 10 % 10 3 is 12345 / 100 % 10 2 is 12345 / 1000 % 10 1 is 12345 / 10000 % 10
5
12345 % 10
4
12345 / 10 % 10
3
12345 / 100 % 10
2
12345 / 1000 % 10
1
12345 / 10000 % 10
I won't provide a complete code as this surely looks like homework, but I'm sure you get the pattern.