diff --git a/字符分类统计 b/字符分类统计 new file mode 100644 index 0000000..e96e190 --- /dev/null +++ b/字符分类统计 @@ -0,0 +1,21 @@ +#include +int a=0,b=0,c=0,d=0,e=0; +void fun(char ch[]) +{ + for(int i = 0; i < 10; 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++; + } +} +int main() +{ + char ch[10]; + scanf("%s",ch); + fun(ch); + printf("majuscule=%d\nb=%d\nnum=%d\nblank=%d\nothers=%d",a,b,c,d,e); + return 0; +} \ No newline at end of file