#include <iostream>
#include <string>
using namespace std;
void PrintIntro();
void PlayGame();
string GetGuess();
void PrintBack(string Guess);
// the entry point for our application
int main()
{
PrintIntro();
PlayGame();
return 0;
}
void PlayGame()
{
// loop of the number of turns asking for guesses
constexpr int NUMBER_OF_TURNS = 5;
for (int count = 1; count <= NUMBER_OF_TURNS; count++)
{
PrintBack(GetGuess());
cout << endl;
}
}
// introduce the game
void PrintIntro()
{
constexpr int WORD_LENGTH = 9;
cout << "Welcome to Bulls And Cows, a fun word game!\n";
cout << "Can you guess the " << WORD_LENGTH;
cout << " letter isogram I'm thinking of?\n";
cout << endl;
return;
}
string GetGuess()
{
//get a guess from user
cout << "Enter your guess: ";
string Guess = "";
getline(cin, Guess);
return Guess;
}
void PrintBack(string Guess)
{
//repeat the guess back to them
cout << "Your guess was: " << Guess << endl;
return;
}
2 Likes
Looks great! Well done