3.7.5 进入游戏主循环
接下来,程序进入游戏主循环。
循环不断要求玩家猜测单词,直到玩家猜对单词或要求退出。
- while ((guess != theWord) && (guess != "quit"))
- {
- if (guess == "hint")
- {
- cout << theHint;
- }
- else
- {
- cout << "Sorry, that's not it.";
- }
- cout <<"\n\nYour guess: ";
- cin >> guess;
- }
3.7.5 进入游戏主循环
接下来,程序进入游戏主循环。
循环不断要求玩家猜测单词,直到玩家猜对单词或要求退出。
- while ((guess != theWord) && (guess != "quit"))
- {
- if (guess == "hint")
- {
- cout << theHint;
- }
- else
- {
- cout << "Sorry, that's not it.";
- }
- cout <<"\n\nYour guess: ";
- cin >> guess;
- }