< Previous | Contents | Next >
Next, I enter the game loop.
while ((guess != theWord) && (guess != "quit"))
{
if (guess == "hint")
{
cout << theHint;
}
else
{
cout << "Sorry, that’s not it.";
}
cout <<"\n\nYour guess: ";
110 Chapter 3 n For Loops, Strings, and Arrays: Word Jumble
cin >> guess;
}
The loop continues to ask the player for a guess until the player either guesses the word or asks to quit.