The "for" function does not want to work

i copied it down exactly but the GetGuessAndPrintback() only comes up once.

1 Like

it was on section 2 lecture 18

Providing your code would be necessary to know what’s wrong.

#include
#include

using namespace std;

void PrintIntro();
string GetGuessAndPrintback();

//entry point of game
int main()
{
PrintIntro();

//loop for number of turns for asking
for (int count = 1; count <= 5; count++);
{
	GetGuessAndPrintback();
	cout << endl;

}

return 0;

}

//introduce the game
void PrintIntro()
{
constexpr int WORLD_LENGTH = 9;
cout << “Welcome to Bulls and Cows!\n”;
cout << “Can you guess the " << WORLD_LENGTH;
cout << " letter isogram I’m thinking of?\n”;
cout << endl;
return;
}
//get guess from the player
string GetGuessAndPrintback()
{
cout << "Enter your guess: ";
string Guess = “”;
getline(cin, Guess);

//print the guess back to them
cout << "Your guess was: " << Guess << endl;
cout << endl;
return Guess;

}

its supposed to ask me to give five guesses but it only gives me one guess

You have a semi-colon at the end, so the next part

{
    GetGuessAndPrintback();
    cout << endl;
}

Isn’t within the scope of the loop.

2 Likes

Are you serious? All i needed to do was remove a semi colon?
Thanks for the help