#Counting Digits in C++
Theoretically, taking the ceiling of the base-10 logarithm of a number should give you the number of digits for that number, but watch for powers of 10. Does looping over the digits slow down the program? You can't tell without profiling it in practice.