JustWannaHugU
代码如下,望采纳#include<stdio.h>
int main()
{
char ch;
int letter=0,i,blank=0,number=0,others=0;
printf("请输入一串字符:");
while((ch=getchar())!= '\n')
{
if('a'<=ch && ch<='z' || 'A'<=ch && ch<='Z')
{
letter++;
}
else if('0'<=ch&&ch<='9')
{
number++;
}
else if(ch==' ')
{
blank++;
}
else
{
others++;
}
}
printf("英文字母:%d、空格:%d、数字:%d、其他字符:%d\n",letter,blank,number,others);
return 0;
}