解题思路:
注意事项:
参考代码:
#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++代码)浏览:952 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:600 |
数组输出 (C语言代码)浏览:728 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:787 |
盐水的故事 (C语言代码)浏览:1552 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:433 |
【偶数求和】 (C语言代码)浏览:445 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:532 |
C语言程序设计教程(第三版)课后习题7.5 (C++代码)浏览:1431 |
简单的a+b (C语言代码)浏览:633 |