📅  最后修改于: 2022-03-11 14:48:21.481000             🧑  作者: Mango
#include
#include
unsigned int getNumberOfDigits (int i)
{
return i > 0 ? log10((double) i) + 1 : 1;
}
int main()
{
std::cout << "Number of digits: " << getNumberOfDigits(/*Example*/6738) << std::endl;
return 0;
}