问题遇到的现象和发生背景
C语言 abc求最大值
大一新生 老师布的作业
问题相关代码,请勿粘贴截图
int max(int a,int b,int c)
{
int d;
if(a>b and a>c)d=a;
(这里)else if(b>c and b>a)d=b;
else d=c;
return (d);
}
运行结果及报错内容
C:\Users\Administrator\Desktop\03.cpp(15) : error C2146: syntax error : missing ';' before identifier 'b'
C:\Users\Administrator\Desktop\03.cpp(15) : error C2059: syntax error : ')'
C:\Users\Administrator\Desktop\03.cpp(15) : error C2146: syntax error : missing ';' before identifier 'd'
C:\Users\Administrator\Desktop\03.cpp(15) : warning C4552: '>' : operator has no effect; expected operator with side-effect
C:\Users\Administrator\Desktop\03.cpp(16) : error C2181: illegal else without matching if
执行 cl.exe 时出错.
我的解答思路和尝试过的方法
说实话,完全不知道怎么错了
我想要达到的结果
我只想知道怎么错了啊,其他方法也没学。就是照着书上弄的啊