解题思路:
注意事项:
参考代码:
#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 人评分
WU-C语言程序设计教程(第三版)课后习题11.12 (C++代码)(想学链表的小伙伴可以看看)浏览:905 |
循环入门练习5 (C语言代码)浏览:839 |
字符逆序 (C语言代码)浏览:621 |
大神老白 (C语言代码)浏览:601 |
矩形面积交 (C语言代码)浏览:1314 |
复数求和 (C语言代码)浏览:929 |
C语言训练-自守数问题 (C语言代码)浏览:749 |
排序算法(选择,插入,冒泡)浏览:775 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:510 |
C语言训练-字符串正反连接 (C语言代码)浏览:632 |