解题思路:
注意事项:
根据ASCII码判断的
参考代码
#include<stdio.h>
#include<string.h>
int main()
{
int zimu=0;
int num=0;
int space=0;
int other=0;
int i,l;
char a[100];
gets(a);
l=strlen(a);
for(i=0; i<l; i++)
{
if((a[i]>=65&&a[i]<=90)||(a[i]>=97&&a[i]<=122))
{
zimu++;
}
else if(a[i]>=48&&a[i]<=57)
{
num++;
}
else if(a[i]==' ')
{
space++;
}
else
{
other++;
}
}
printf("%d %d %d %d \n",zimu,num,space,other);
return 0;
}
:
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题11.11 (C语言代码)浏览:749 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:611 |
【亲和数】 (C语言代码)浏览:700 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)万恶的long long浏览:848 |
C语言训练-大、小写问题 (C语言代码)浏览:695 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:759 |
打印十字图 (C语言代码)浏览:2668 |
大家好,我是验题君浏览:561 |
核桃的数量 (C语言代码)浏览:864 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:552 |