It works.The question is, am I complicating it ?
#include
#include
using namespace std;
void introprint();
void PlayGame();
string Getguess();
void PrintGuess(string s);
//Entry point
int main ()
{
introprint();
PlayGame();
return 0;//Exit Applicatoin
}
void PlayGame()
{
//loop for number of guesses
constexpr int NUMBER_OF_GUESSES = 5;
for (int i = 1; i <= NUMBER_OF_GUESSES; i++)
{
string Guess = Getguess();
PrintGuess(Guess);
cout << endl;
}
}
void introprint()
{
//introduction
constexpr int WORD_LENGTH = 5;
cout << “Welcome to the game.\n”;
cout << “Can you guess the " << WORD_LENGTH;
cout << " letter isogram that I’m thinking of?\n”;
cout << endl;
return;
}
string Getguess()
{
//Get the player’s guess
cout << "Please enter your guess: ";
string Guess = “”;
getline(cin, Guess);
return Guess;
}
void PrintGuess(string s)
{
//Repeat the player’s guess
cout << "You guessed " << s << endl;
}