#include<stdio.h>
int main()
{
int letter=0,digit=0,blank=0,other=0;
int i;
char ch;
for(i=0;i<=9;i++){
scanf("%c",&ch);
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else if(ch==' '||ch=='\n')
blank++;
else
other++;
}
scanf("%c",&ch);
printf("letter = %d, blank = %d, digit = %d, other = %d",letter,blank,digit,other);
return 0;
}
练习3-4 统计字符(15 分)water
最新推荐文章于 2022-09-04 15:35:05 发布