不知道哪里出了问题
输入一行字符,分别统计出包含英文字母、空格、数字和其它字符的个数。
#include <stdio.h>
int main()
{
char a[1000];
int count=0,count1=0,count2=0,other=0;
while(scanf("%s",&a[1000])!=EOF)
{
for(int i=0;i<1000;i++)
{
if((a[i]>='a' && a[i]<='z')||(a[i]>='A' && a[i]<='Z'))
count++;
else
if(a[i]==' ')
count1++;
else
if(a[i]>='0' && a[i]<='9')
count2++;
else
other++;
}
}
printf("%d\n%d\n%d\n%d\n",count,count1,count2,other);
return 0;
}