To extract the digits out of an integer number, you need to know just a little bit about how modular arithmetic works, which is similar to division.
For example, say you have the number 123, and you're trying to get the last digit out of it (3). This can actually be done by finding the remainder when you divide 123 by 10.
123 / 10 is 12 (through Integer division, which essentially truncates 12.3), but the remainder of 123 when divided by 10 is 3.
In C++, this is calculated through the % ("modulo") operator. 123 % 10 gives you a result of 3.
So, in general, you can get the least-significant digit of an integer by finding its remainder, modulo 10. And you can remove the least-significant digit by dividing by 10.