#include<iostream>
using namespace std;
inline bool IsNumber(char ch);
int main()
{
int count = 0;
char c;
do
{
c = cin.get();
if (IsNumber(c))
{
count++;
}
} while (c != '\n');
cout << "数字个数为" << count << "个" << endl;
return 0;
}
inline bool IsNumber(char ch)
{
return(ch >= '0' && ch <= '9') ? true : false;
}
07-05
6279
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-23
7072
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-19
6460
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交