解题思路:
注意事项:
参考代码:
#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语言代码)浏览:785 |
1071题解浏览:484 |
C二级辅导-进制转换 (C语言代码)浏览:660 |
DNA (C语言代码)浏览:735 |
班级人数 (C语言代码)浏览:920 |
字符删除 (C语言代码)浏览:715 |
统计立方数 (C语言代码)浏览:863 |
简单的a+b (C语言代码)浏览:645 |
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:926 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:501 |