1 Star 0 Fork 1.5K

Penn.Lin / ndd

forked from 爬山虎 / ndd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
common.cpp 526 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include "common.h"
int nbDigitsFromNbLines(size_t nbLines)
{
int nbDigits = 0; // minimum number of digit should be 4
if (nbLines < 10) nbDigits = 1;
else if (nbLines < 100) nbDigits = 2;
else if (nbLines < 1000) nbDigits = 3;
else if (nbLines < 10000) nbDigits = 4;
else if (nbLines < 100000) nbDigits = 5;
else if (nbLines < 1000000) nbDigits = 6;
else // rare case
{
nbDigits = 7;
nbLines /= 1000000;
while (nbLines)
{
nbLines /= 10;
++nbDigits;
}
}
return nbDigits;
}
C++
1
https://gitee.com/penn6699/notepad--.git
git@gitee.com:penn6699/notepad--.git
penn6699
notepad--
ndd
master

搜索帮助