简体   繁体   English

“||”之前的预期主表达式错误令牌

[英]Error expected primary-expression before '||' token

Currently trying to complete my C++ Assignment, the code isnt complete yet, but I was just trying to compile it and I ran into this error.目前正在尝试完成我的 C++ 赋值,代码尚未完成,但我只是在尝试编译它,但遇到了这个错误。 I cant seem to figure out how to fix it, any pointers?我似乎无法弄清楚如何解决它,任何指针? Please excuse this super noobie question.. im still a beginner in an intro course.请原谅这个超级菜鸟的问题..我仍然是入门课程的初学者。

Code代码

Your parentheses are messed up.你的括号乱了。 An if statement condition in C++ should be wrapped in a parenthesis like so: C++ 中的if语句条件应该用括号括起来,如下所示:

if ( animal == 'D' || animal == 'd' )...

if ( status == 'Y' || status == 'y' )...

else if ( status == 'N' || status == 'n')...

You if condition must be enclosed by a single bracket你 if 条件必须用一个括号括起来

if ((animal == 'D') || (animal == 'd'))

& &

if((status == 'Y) || (status == 'y))

& &

else if((status == 'N') || (status == 'n'))

Your If syntax is wrong, sweetie.你的 If 语法错误,亲爱的。 You have missed the round brackets.你错过了圆括号。 Should be:应该:

if((status == 'N') || (status == 'n'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM