Last updated 1 year ago
Was this helpful?
When you want to get all the digits of a integer n, instead of doing n /= 10, n % 10, use to_string(n). It's shorter and less error-prone. For example, you don't need to consider n = 0.
n
n /= 10, n % 10
to_string(n)
n = 0