C++ count the number of digits of a double -


i want title says this:

int number1; cin>>number1; num1len=log10(number1)+1; cout<<"num of digits "<<num1len<<"\n"; 

but when number of digits 11 , more answer 7(6+1)

does knows why or im doing wrong?

what 'wrong' maximum value can stored in (signed) int :

#include <iostream> #include <numeric>  int main() {     std::cout << std::numeric_limits<int>::max() << std::endl; } 

gives me :

2147483647


Comments

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -