输出不了想要结果,求大神指正
#include<stdio.h>#include<math.h>
int main()
{
int letnum=0,spanum=0,numnum=0,othnum=0;
char c;
while (c=getchar()!='\n')
if ((c<='Z'&&c>='A')||(c>='a'&&c<='z'))
letnum=letnum+1;
else{ if (c<='9'&&c>='0')
numnum=numnum+1;
else{ if (c==' ')
spanum=spanum+1;
else
othnum=othnum+1;}}
printf("letnum=%d\nnumnum=%d\nspanum=%d\nothnum=%d\n",letnum,numnum,spanum,othnum);
return 0;
}
输出:
abc 123 gf
letnum=0
numnum=0
spanum=0
othnum=10
Press any key to continue