设计函数,求字符串中数字的个数

[复制链接]
查看11 | 回复3 | 2013-5-8 23:04:56 | 显示全部楼层 |阅读模式
#include int main(){char str[100];gets(str);int k=0;for(int i=0;str!='\0';i++)if(str>='0'&&strint num(char *str){
int number=0;
for(;*str!='\0';str++){
if((*str='0'))
number++;
}
return number;}v...
回复

使用道具 举报

千问 | 2013-5-8 23:04:56 | 显示全部楼层
#include#includeusing namespace std;void main(){char a[100]={0};int count=0;gets(a);for(int i=0;a!='\0';i++){if(a>='0'&&a<='9'){count...
回复

使用道具 举报

千问 | 2013-5-8 23:04:56 | 显示全部楼层
楼下正确的...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行