2012-03-29 98 views
-4

爲什麼我收到此錯誤消息?此行的錯誤消息

Error: expected a ';' 

來自:

int main() 
{ 
    int score; 
    double distance; 
    char playAgain; 
    bool shieldsUp; 

    short lives; 
    short aliensKilled; 

    score = 0 
    distance = 1200.76; 
    playAgain = 'y'; 
    shieldsUp = true; 
    lives = 3 
    aliensKilled = 10; 

誤差爲distance = 1200.76;aliensKilled = 10;下,

+0

你知道,缺少分號...看看一行。然而,如果你躲避敵人,那麼不要依賴忘記仰望的人:往往最好的藏身之處就在地面上(只是小費)。 – 2012-03-29 01:08:11

+2

請購買[C++書籍](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list)並閱讀它! – 2012-03-29 01:09:25

回答

1

您有:

score = 0 

你想:

score = 0; 

類似的lives = 3

1

你真的忘了的東西:

... 
score = 0; 
... 
lives = 3; 
...