4.8.4 进入游戏主循环

2013-10-07 14:45:38 · 作者: · 浏览: 59

4.8.4  进入游戏主循环

接下来,程序进入游戏主循环。该循环将持续执行,直到玩家猜错次数过多或者猜中单词。

  1. //main loop  
  2. while ((wrong < MAX_WRONG) && (soFar != THE_WORD))  
  3. {  
  4. cout << "\n\nYou have " << (MAX_WRONG - wrong);  
  5. cout << " incorrect guesses left.\n";  
  6. cout << "\nYou've used the following letters:\n" << used << endl;  
  7. cout << "\nSo far, the word is:\n" << soFar << endl;