📜  hwo 在 c++ 代码示例中使用 log 计算位数

📅  最后修改于: 2022-03-11 14:44:45.729000             🧑  作者: Mango

代码示例1
#include 
#include 
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;
}