From 1a3355e62b1621bfce685f4fecd140c00f3b7ebd Mon Sep 17 00:00:00 2001 From: p3i4gu5vn <1796370411@qq.com> Date: Sat, 19 Feb 2022 23:20:19 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E5=AD=97=E7=AC=A6=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 字符分类统计 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 字符分类统计 diff --git a/字符分类统计 b/字符分类统计 new file mode 100644 index 0000000..2d224a1 --- /dev/null +++ b/字符分类统计 @@ -0,0 +1,27 @@ +#include +int main() +{ + char a[10]; + int da,xiao,shu,kong,qi; + scanf("%s",a); + for(int i=0;a[i];i++) + { + if(a[i]>='A'&&a[i]<='Z') + da++; + else if(a[i]>='a'&&a[i]<='z') + xiao++; + else if(a[i]>='0'&&a[i]<='9') + shu++; + else if(a[i]==' ') + kong ++; + else + qi++; + + } + printf("大写字母:%d\n",da); + printf("小写字母:%d\n",xiao); + printf("数字:%d\n",shu); + printf("空格:%d\n",kong); + printf("其他:%d\n",qi); +return 0; +} \ No newline at end of file