代码如下:

int GetIntLength(int i)
{
   int len=1;
   if(i<0) i = -i;
   for(;i/10>0; i /= 10)
      ++len;
   return len;
}

今天就为了交换整数的首末尾需要计算一个数的长度卡在这里好久,不过最后还是解决了,很nice!
转载于:https://bbs.csdn.net/topics/350102736

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2021-04-24
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2023-02-06
  • 2022-03-06
  • 2022-12-23
  • 2021-07-07
  • 2022-02-23
  • 2021-10-03
相关资源
相似解决方案