Comprimento de int ou decimal
#include<cmath>
...
int size = trunc(log10(num)) + 1
....
Glamorous Goose
#include<cmath>
...
int size = trunc(log10(num)) + 1
....