How do I get what the digits of a number are in C++ without converting it to strings or character arrays?
A simple solution would be to use the log 10 of a number. It returns the total digits of the number - 1. It could be fixed by using converting the number to an int.
int(log10(number)) + 1