解题思路:
注意事项:
参考代码:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch;
int character=0,number=0,blank=0,other=0;
while((ch=getchar())!='\n')
{
( (ch>='A'&&ch<='Z')||(ch>='a'&&ch<='z') ) ? character++ : (ch>='0'&&ch<='9') ? number++ : (ch==' ') ? blank++ : other++;
}
printf("%d,%d,%d,%d\n",character,number,blank,other);
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:637 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:570 |
剪刀石头布 (C语言代码)不知道怎么直接在scanf中用枚举变量浏览:1316 |
数组输出 (C语言代码)--此题的题目描述有问题浏览:1817 |
WU-拆分位数 (C++代码)浏览:784 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:660 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:569 |
1014题解浏览:485 |
罗列完美数 (C语言代码)浏览:491 |
1071题解浏览:493 |