解题思路:
注意事项:
根据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语言程序设计教程(第三版)课后习题8.3 (Java代码)浏览:1386 |
哥德巴赫曾猜测 (C语言代码)浏览:1060 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:557 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:600 |
【魔板】 (C++代码)浏览:1207 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:542 |
拆分位数 (C语言代码)浏览:449 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:465 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:682 |
金额的中文大写浏览:3644 |