Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- void PrintIntro();
- string GetGuess();
- void FiveTries();
- void PrintGuess();
- string Guess = "";
- // The entry point for our applicaiton
- int main()
- {
- PrintIntro();
- FiveTries();
- return 0;
- }
- // Introduce the game
- void PrintIntro()
- {
- constexpr int WORD_LENGTH = 5;
- cout << "Welcome to Bulls and Cows, a fun word game." << endl;
- cout << "Can you guess the " << WORD_LENGTH << " letter isogram I am thinking of?" << endl;
- cout << endl;
- return;
- }
- // Limits the time the player can guess to 5
- void FiveTries()
- {
- constexpr int GUESS_LENGTH = 5;
- for (int i = 1; i <= GUESS_LENGTH; i++)
- {
- PrintGuess();
- cout << endl;
- }
- return;
- }
- // Gets guess input from the player
- string GetGuess()
- {
- cout << "Guess the word: ";
- string Guess = "";
- getline(cin, Guess);
- return Guess;
- }
- // Prints the user's guess
- void PrintGuess()
- {
- cout << "Your guess is: " << GetGuess() << endl;
- return;
- }
Add Comment
Please, Sign In to add comment