From 7ae74eba516ee47b84fe47dd35fcb8796ece5efd Mon Sep 17 00:00:00 2001 From: pwjku6f2y <1915106350@qq.com> Date: Tue, 15 Feb 2022 14:06:59 +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 --- 字符分类统计.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 字符分类统计.c diff --git a/字符分类统计.c b/字符分类统计.c new file mode 100644 index 0000000..faae683 --- /dev/null +++ b/字符分类统计.c @@ -0,0 +1,27 @@ +#include +void Stringcount(char s[]) +{ + int le1=0,le2=0,di=0,sp=0,ot=0; + int i; + for(i=0;s[i] != '\0';i++) + { + if(s[i] >='A' && s[i] <='Z') + le1++; + else if(s[i] >= 'a' && s[i] <= 'z') + le2++; + else if(s[i] >= '0' && s[i] <= '9') + di++; + else if(s[i]==' ') + sp++; + else + ot++; + } + printf("��д��ĸ��%d Сд��ĸ��%d ���֣�%d �ո�%d �����ַ���%d",le1,le2,di,sp,ot); +} +int main() +{ + char a[10]; + gets(a); + Stringcount(a); + return 0; + }