You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fun/字符分类统计.cpp

23 lines
318 B

#include<stdio.h>
int main()
{
char a[10];
int i,f,b,c,d,e;
gets(a);
for(i=0;i<10;i++)
{
if(a[i]>='a'&&a[i]<='z')
f++;
else if(a[i]>='A'&&a[i]<='Z')
b++;
else if(a[i]>='0'&&a[i]<='9')
c++;
else if(a[i]==' ')
d++;
else
e++;
}
printf("%d %d %d %d %d",f,b,c,d,e);
}