Guest User

Untitled

a guest
Jun 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. void PrintIntro();
  8. string GetGuess();
  9. void FiveTries();
  10. void PrintGuess();
  11. string Guess = "";
  12.  
  13. // The entry point for our applicaiton
  14. int main()
  15. {
  16. PrintIntro();
  17. FiveTries();
  18. return 0;
  19. }
  20.  
  21. // Introduce the game
  22. void PrintIntro()
  23. {
  24. constexpr int WORD_LENGTH = 5;
  25.  
  26. cout << "Welcome to Bulls and Cows, a fun word game." << endl;
  27. cout << "Can you guess the " << WORD_LENGTH << " letter isogram I am thinking of?" << endl;
  28. cout << endl;
  29. return;
  30. }
  31.  
  32. // Limits the time the player can guess to 5
  33. void FiveTries()
  34. {
  35. constexpr int GUESS_LENGTH = 5;
  36. for (int i = 1; i <= GUESS_LENGTH; i++)
  37. {
  38. PrintGuess();
  39. cout << endl;
  40. }
  41. return;
  42. }
  43.  
  44. // Gets guess input from the player
  45. string GetGuess()
  46. {
  47. cout << "Guess the word: ";
  48. string Guess = "";
  49. getline(cin, Guess);
  50. return Guess;
  51. }
  52.  
  53. // Prints the user's guess
  54. void PrintGuess()
  55. {
  56. cout << "Your guess is: " << GetGuess() << endl;
  57. return;
  58. }
Add Comment
Please, Sign In to add comment