Compare commits
No commits in common. '字符分类统计' and 'master' have entirely different histories.
@ -1,30 +0,0 @@
|
|||||||
//字符分类统计
|
|
||||||
#include<stdio.h>
|
|
||||||
#define N 10
|
|
||||||
void fun(char ch[])
|
|
||||||
{
|
|
||||||
int a=0,b=0,c=0,d=0,e=0;
|
|
||||||
for(int i=0;i<N;i++)
|
|
||||||
{
|
|
||||||
if(ch[i]>='A'&&ch[i]<='Z')
|
|
||||||
a++;
|
|
||||||
else if(ch[i]>='a'&&ch[i]<='z')
|
|
||||||
b++;
|
|
||||||
else if(ch[i]>='0'&&ch[i]<='9')
|
|
||||||
c++;
|
|
||||||
else if(ch[i]==' ')
|
|
||||||
d++;
|
|
||||||
else
|
|
||||||
e++;
|
|
||||||
}
|
|
||||||
printf("%d %d %d %d %d",a,b,c,d,e);
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char ch[N];
|
|
||||||
for(i=0;i<N;i++)
|
|
||||||
scanf("%c",&ch[i]);
|
|
||||||
fun(ch);
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in new issue