From c25598a7e00abaafb8e11bead1aa03c9ceceff1a Mon Sep 17 00:00:00 2001 From: puy4bwhfe <3207267310@qq.com> Date: Sat, 19 Feb 2022 14:37:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E7=AC=A6=E5=88=86=E7=B1=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 字符分类统计 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 字符分类统计 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