SyntaxFix
Write A Post
Hire A Developer
Questions
There is a much better way to do it
#include<cmath> ... int size = trunc(log10(num)) + 1 ....
works for int and decimal