#include "stdafx.h"
#include "string.h"
int main()
{
char a[100] = {0};
int len, i, c_letters = 0, c_blocks = 0,c_nums=0,c_others=0;
gets_s(a, sizeof(a)); // gets(a);
len = strlen(a);
for (i = 0; i < len; i++)
{
if ((a[i] >= 'a'&&a[i] <= 'z') || (a[i] >= 'A'&&a[i] <= 'Z'))
c_letters++;
else if (a[i] == ' ')
c_blocks++;
else if ((a[i] >= '0'&&a[i] <= '9'))
c_nums++;
else
c_others++;
}
printf("%d\n", c_letters);
printf("%d\n", c_blocks);
printf("%d\n", c_nums);
printf("%d\n", c_others);
return 0;
}
0.0分
0 人评分
C语言训练-谁家孩子跑最慢* (C语言代码)浏览:1508 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:533 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)scanf后面加个getchar(),收掉回车符,就可以用gets了浏览:1149 |
最长单词 (C语言代码)浏览:1377 |
用筛法求之N内的素数。 (C语言代码)浏览:1260 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:770 |
WU-陶陶摘苹果2 (C++代码)浏览:975 |
【明明的随机数】 (C语言代码)浏览:787 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:811 |
C二级辅导-温度转换 (C语言代码)浏览:732 |