C语言题目 有一篇文章,共有3行文字,每行有个80字符.要求分别统计出

有一篇文章,共有3行文字,每行有个80字符.要求分别统计出其中英文大写字母、小写字母、空格以及其它字符的个数.

#include "stdio.h"
#include "string.h"
main()
{ char str[3][100];
int i,j,a=0,b=0,c=0,d=0,e=0;
for(i=0;i<=2;i++)
gets(str[i]);
for(i=0;i<=2;i++)
for (j=0;j<80;j++)
{ if (str[i][j]>=65&&str[i][j]<=90)
a++;
else if (str[i][j]>=97&&str[i][j]<=122)
b++;
else if (str[i][j]>=48&&str[i][j]<=57)
c++;
else if (str[i][j]=32)

d++;
else
e++;
}
printf("daxie %d xiaoxie %d shuzi%d kongge %d qita %d",a,b,c,d,e);
getch();
}

麻烦帮我看看问题出在哪?编译下来其他字符全部进了空格

else if (str[i][j]=32)此句错了
应该是
else if (str[i][j]==32)
=是赋值,==才是判断是否相等
如果是 else if (str[i][j]=32)则每执行一次,括号内的值都是非零,所以每执行都会d++.所以才会有编译下来其他字符全部进了空格
温馨提示:答案为网友推荐,仅供参考