解题思路:
注意事项:
参考代码:
#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语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:639 |
蛇行矩阵 (C++代码)(预生成结果以节省每次生成的时间)浏览:823 |
C二级辅导-求偶数和 (C语言代码)浏览:640 |
简单的a+b (C语言代码)浏览:649 |
【蟠桃记】 (C语言代码)浏览:652 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:1526 |
拆分位数 (C语言代码)浏览:1330 |
简单的a+b (C语言代码)浏览:574 |
程序员的表白 (C语言代码)浏览:669 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1099 |