解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<ctype.h>
int main(void)
{
char all[100];
int i=0;
int _ch=0;//字母数
int _num=0;//数字数
int _space=0;//空格数
int _other=0;//其他字符数
printf("input:");
gets(all);
while(all[i])
{
if(isalpha(all[i]))
_ch++;
else if(isdigit(all[i]))
_num++;
else if(isblank(all[i]))
_space++;
else
_other++;
i++;
}
printf("%d %d %d %d\n",_ch,_num,_space,_other);
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:661 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:480 |
众数问题 (C语言代码)浏览:821 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:468 |
C二级辅导-等差数列 (C语言代码)浏览:808 |
孤独的骑士 (C语言代码)浏览:1360 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:1317 |
素数的个数 一直是超时浏览:666 |
拯救雅典娜浏览:1237 |
简单的a+b (C++代码)浏览:438 |