length of number c++
#include<cmath> ... int size = trunc(log10(num)) + 1 ....
Source: stackoverflow.com
length of number c++
std::to_string(num).length()
Source: stackoverflow.com