My Implementation keeps track of what guess your on

#include
#include

using namespace std;

void PrintIntro()
{
//introduce the game
constexpr int WORD_LENGTH = 5;
cout << “Welcome to Bulls and Cows\n”;
cout << “Can you guess the " << WORD_LENGTH;
cout << " letter isogram?\n”;
cout << endl;

return;

}

string GetGuess()
{
//receive user input
cout << "Enter Your Guess: ";
string Guess = “”;
getline(cin, Guess);
cout << endl;

return Guess;

}

void PlayGame()
{
constexpr int GUESS_NUM = 5;
for (int i = 1; i <= GUESS_NUM; i++) {
cout << "GUESS NUMBER: " << i << endl;
string Guess = GetGuess();
//repeat the input back to the user
cout << "Your guess was " << Guess << endl;
cout << endl;
}
return;
}

int main()
{
PrintIntro();
PlayGame();
return 0;
}

Privacy & Terms