#include
#include
#include “FBullCowGame.h”
void PrintIntro();
void PlayGame();
std::string GetGuess();
bool AskToPlayAgain();
int main()
{
do {
PrintIntro();
PlayGame();
} while (AskToPlayAgain() == true );
return 0;
}
//Loop
void PlayGame()
{
FBullCowGame BCGame;
int MaxTries = BCGame.GetMaxTries;
std::cout << MaxTries << std::endl;
for (int count = 1; count <= MaxTries; count++)
{
std::string Guess = GetGuess();
std::cout << "Your guess was: " << Guess << std::endl;
std::cout << std::endl;
}
}
void PrintIntro()
{
//Intro
constexpr int WORLD_LENGTH = 9;
std::cout << “Welcome to Bulls and Cows\n”;
std::cout << “can you guess the " << WORLD_LENGTH;
std::cout << " letter isogram i’m thinking of\n”;
std::cout << std::endl;
return;
}
std::string GetGuess()
{
//guess
std::cout << "Write your guess: ";
std::string Guess = “”;
std::getline(std::cin, Guess);
return Guess;
}
bool AskToPlayAgain()
{
std::cout << "Do you want to play again? ";
std::string Response = “”;
std::getline(std::cin, Response);
return false (Response[0] == 'y') || (Response[0] == 'Y');
}