原代码如下,运行后标注位置报错expected ')' before 'and',初步猜测和and的机制有关,例子为打印1 and 1或true and true的值时同样会出现此报错,求解答!
//读取单词个数等.c
#include<stdio.h>
#include<ctype.h>
int main(void)
{
char ch;
int word = 0,line = 0,chnum = 0;
printf("请输入英语句子,将读取有几个单词,可包含回车,以\"|\"结束:");
while((ch = getchar()) != '|')
{
chnum++;
if(ch == '\n')
line++;
if(isalpha(ch) or isdigit(ch))//出错位置为该行,报错expected ')' before 'and'
word++;
}
printf("该句子有%d个字符,%d个单词,%d行",chnum,word,line);
return 0;
}