('A'<=ch<='Z'||'a'<=ch'z')不行?
在累计输入字符时,
我用 if ('A'<=ch<='Z'||'a'<=ch'z')letter++;
else if (ch==' ')space++;
else if('0'<=ch<='9')digit++;
else other++;
这样不行;
改成 if(ch<='z'&&ch>='a'||ch<='Z'&&ch>='A') letter++;
else if(ch==' ') space++;
else if(ch<='9'&&ch>='0') digit++;
else other++;
就可以了。
这是为什么?是不是('A'<=ch<='Z'||'a'<=ch'z')这样表示是不行的?为什么?
请教朋友