我写这个是为了好玩:
#include <iostream>
#include <cstdlib>
using namespace std;
int Arsenal = rand()%3;
int Norwich = rand()%3;
int main () {
if (Arsenal > Norwich) {
cout << "Arsenal win the three points, they are in the Top Four";
return 0;
} else if (Arsenal == Norwich) {
cout << "The game was a draw, both teams gained a point";
return 0;
} else (Norwich > Arsenal) {
cout << "Norwich won, Arsenal lost";
return 0;
}
}
我试图用 g++ 编译它,但我得到了这个错误:
arsenalNorwich.cpp: In function, 'int main'
arsenalNorwich.cpp:15:30: error: expected ';' before '{' token
我不知道我做错了什么,我学校的 CS 导师也不知道。虽然只是为了好玩,但它让我发疯。