解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int i,m;
int letter=0;
int space=0;
int num=0;
int other=0;
char str[100];
gets(str);
m=strlen(str);
for(i=0; i<m; i++)
{
if((str[i]>=65&&str[i]<=90)||(str[i]>=97)&&(str[i]<=122))
letter++;
else if(str[i]==' ')
space++;
else if(str[i]>=48&&str[i]<=57)
num++;
else
other++;
}
printf("%d %d %d %d\n",letter,space,num,other);
return 0;
}
0.0分
0 人评分
C二级辅导-计负均正 (C语言代码)浏览:587 |
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:584 |
C语言训练-自守数问题 (C语言代码) long long浏览:1061 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:1435 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:619 |
【蟠桃记】 (C语言代码)浏览:648 |
【亲和数】 (C语言代码)浏览:492 |
蛇行矩阵 (C语言代码)浏览:742 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:464 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:901 |