Answers for "how to get the length of a int in c++"

C++
2

length of number c++

#include<cmath>
    ...
    int size = trunc(log10(num)) + 1
....
Posted by: Guest on December-29-2021
0

length of number c++

std::to_string(num).length()
Posted by: Guest on December-29-2021
0

c++ length of int

unsigned int number_of_digits = 0;

do {
     ++number_of_digits; 
     n /= base;
} while (n);
Posted by: Guest on September-10-2020

Code answers related to "how to get the length of a int in c++"

Browse Popular Code Answers by Language