Error with do

I have checked over the video and my code seems to be the exact same but yet when my console asks me to start a new game no matter what I type it starts a new game the error list says that there is somethin wrong with the do part - this is my code below.

using namespace std;

void PrintIntro();
bool AskToPlayAgain();
void PlayGame();
string GetGuess();
string PrintGuess();
string Guess = “”;

// The entry point for our application
int main()
bool bPlayAgain = false
do {
bPlayAgain = AskToPlayAgain();
while (bPlayAgain);

return 0; // exit application


void PlayGame()
// Loop for the number of turns asking for guesses
constexpr int NUM_TURNS = 5;
for (int count = 1; count <= NUM_TURNS; count++) {
cout << endl;

// Introduce the game
void PrintIntro() {
constexpr int WORD_LENGTH = 5;
cout << “Welcome To Bulls And Cows!\n”;
cout << “Can you guess the " << WORD_LENGTH;
cout << " letter isogram I’m thinking of?\n”;
cout << endl;

// Get a guess from the player
string GetGuess() {
cout << "Enter Your Guess: ";
getline(cin, Guess);
return Guess;
string PrintGuess() {
// Repeat the guess back to them
cout << "Your Guess Was: " << Guess << endl;
return Guess;

bool AskToPlayAgain()
cout << "Do You Want To Play Again (y/n)? ";
string Response = “”;
getline(cin, Response);
return (Response[0] == ‘y’) || (Response[0] == ‘Y’);


You’re missing a semicolon after bool bPlayAgain = false in main, that should fix it. It’s always the little stuff like that makes the most infuriating bugs :stuck_out_tongue: . Also, when you paste your code on here, go back and highlight it all and hit the “Preformatted text” button, makes it much easier to read.

Privacy & Terms