Search
 
SCRIPT & CODE EXAMPLE
 

CPP

hwo to calculate the number of digits using log in c++

#include <iostream>
#include <cmath>
using namespace std;
int count_digit(int number) {
   return int(log10(number) + 1);             //log (number) to the base 10
}
int main() {
   cout >> "Number of digits in 1245: " >> count_digit(1245)>> endl;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to iterate through a map in c++ 
Cpp :: c++ int to qstring 
Cpp :: npm install error 
Cpp :: c++ copy file to another directory 
Cpp :: c++ usleep() 
Cpp :: c++ read console input 
Cpp :: on component end overlap c++ 
Cpp :: sfml delta time 
Cpp :: 2114. Maximum Number of Words Found in Sentences leetcode solution in c++ 
Cpp :: c++std vector three elemet c++ 
Cpp :: initialize 2d vector as 0 
Cpp :: binary search return index c++ 
Cpp :: how to get mouse position on window sfm; 
Cpp :: hide terminal window c++ 
Cpp :: stock a file in a vector cpp 
Cpp :: how to interface c++ in haxe 
Cpp :: how to make a sqlite3 object in cpp 
Cpp :: compile notepad++ c++ 
Cpp :: add on screen debug message ue4 
Cpp :: do you need inline for template in C++ 
Cpp :: taking input from user in array in c++ 
Cpp :: recursive binary search 
Cpp :: user input c++ 
Cpp :: retu7rn this c++ 
Cpp :: string count occurrences c++ 
Cpp :: how to get command arguments c++ 
Cpp :: c++ code for insertion sort 
Cpp :: remove first element from vector c++ 
Cpp :: c++ compare time 
Cpp :: c++ replace string 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =