解题思路:
注意事项:
参考代码:
#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语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:470 |
DNA (C语言描述,蓝桥杯)浏览:1553 |
1013题解浏览:552 |
字符串比较 (C语言代码)浏览:680 |
敲七 (C++代码)浏览:1050 |
数列排序 (C语言代码)浏览:606 |
字符逆序 (C语言代码)浏览:504 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:539 |
A+B for Input-Output Practice (II) (C语言代码)浏览:596 |
小O的乘积 (C++代码)浏览:747 |