Reputation: 11
#include <iostream>
using namespace std;
int main() { //Main Function
int w;
cout << "enter the weight of the watermelon: ";
cin >> w;
if (w <= 1 or w >= 100) {
cout << "error";
}
else {
if (w % 2 == 0) {
cout << "YES";
}
else {
cout << "NO";
}
}
return 0;
syntax error: missing ')' before identifier 'or'
error C2065: 'or': undeclared identifier
error C2146: syntax error: missing ';' before identifier 'w'
error C2059: syntax error: ')'
error C2059: syntax error: ';'
error C2059: syntax error: 'else'
error C2143: syntax error: missing ';' before '{'
error C2447: '{': missing function header (old-style formal list?)
error C2059: syntax error: 'return'
error C2059: syntax error: '}'
error C2143: syntax error: missing ';' before '}'
Upvotes: 0
Views: 246
Reputation: 17454
or
in C++ is an "alternative token".
Your version of Visual Studio doesn't support these alternative tokens in your compilation mode.
Technically, that is in violation of the C++ standard.
However, it would anyway be more conventional to write ||
, so just do that.
Upvotes: 2