Hello dear @ben and Community,
#include "pch.h"
#include <iostream>
#include <string>
using namespace std;
void PrintIntro();
void PlayGame();
string GetGuess();
void PrintGuess(string);
int main() {
PrintIntro();
PlayGame();
return 0;
}
void PlayGame()
{
constexpr int NUMBER_OF_TURNS = 5;
for (size_t i = 0; i < NUMBER_OF_TURNS; i++) {
cout << "(" << i + 1 << "): ";
PrintGuess(GetGuess());
}
}
void PrintIntro() {
// introduce the game
constexpr int WORLD_LENGTH = 9;
cout << "Welcome to Bulls and Cows, a fun word game.\n";
cout << "Can you guess the " << WORLD_LENGTH;
cout << " letter isogram I'm thinking of?\n";
cout << endl;
return;
}
string GetGuess() {
// get a guess from the player
cout << "Enter your guess: ";
string Guess = "";
getline(cin, Guess);
return Guess;
};
void PrintGuess(string InputString) {
cout << "Your guess was: " << InputString << endl;
return;
}
Kind regards
Kevin