大神,这个输出咋不对呢
#include<stdio.h>
main()
{
char ch;
int letter=0,space=0,digit=0,other=0;
printf("please enter character:\n");
while ((ch=getchar())!='\n');
if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
letter++;
else if(ch==' ')
space++;
else if(ch>='0'&&ch<='9')
digit++;
else
other++;
printf("letter is %d space is %d digit is %d other is %d",letter,space,digit,other);
}
#include<stdio.h>
main()
{
char ch;
int letter=0,space=0,digit=0,other=0;
printf("please enter character:\n");
while ((ch=getchar())!='\n');
if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
letter++;
else if(ch==' ')
space++;
else if(ch>='0'&&ch<='9')
digit++;
else
other++;
printf("letter is %d space is %d digit is %d other is %d",letter,space,digit,other);
}