解题思路:
注意事项:
参考代码:
#include <stdio.h>
int main()
{
char ch;
int letter,number,blank,other;
letter=number=blank=other=0;
while((ch=getchar())!='\n')
{
if(ch>='A'&&ch<='Z'||ch>='a'&&ch<='z')
letter++;
else if(ch>='0'&&ch<='9')
number++;
else if(ch==32)
blank++;
else
other++;
}
printf("%d %d %d %d\n",letter,number,blank,other);
return 0;
}
0.0分
1 人评分
简单的a+b (C语言代码)浏览:760 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:968 |
字符串对比 (C语言代码)浏览:1413 |
不会做的浏览:874 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:2081 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:619 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:461 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:786 |
sizeof的大作用 (C语言代码)浏览:1028 |
判定字符位置 (C语言代码)浏览:799 |