我在寫這一點的樂趣:C++如果語句錯誤:預期';'之前,「{」令牌
#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導師也沒有。儘管這只是爲了好玩,但卻讓我發瘋。
導師不? ............ – chris
*「我不知道我做錯了什麼」 * - 你選擇了一所學校與誰不知道C++導師,通過它的聲音! +1發佈一個格式良好的問題,儘管是全新的stackoverflow。 – JBentley
未來,告訴我們哪一行是第15行。保存每個人不必計算行數。 –