Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. void PrintIntro();
  7. string GetGuess();
  8.  
  9. int main() {
  10.  
  11. PrintIntro();
  12.  
  13. string Guess = "";
  14. Guess = GetGuess();
  15.  
  16. // repeat the guess back to them
  17.  
  18. cout << "Users Guess: " << Guess << "\n";
  19.  
  20. return 0;
  21. }
  22.  
  23. void PrintIntro() {
  24. constexpr int WORD_LENGTH = 5;
  25.  
  26. // introduce the game
  27. cout << "Welcome to bulls and Cows\n";
  28. cout << "Can you guess the " << WORD_LENGTH << " letter isogram I'm thinking of?\n";
  29. return;
  30. }
  31.  
  32. string GetGuess() {
  33. // get a guess from the player
  34. string Guess = "";
  35.  
  36. cout << "\nPlease Enter Guess: ";
  37. getline(cin, Guess);
  38. return Guess;
  39. }
Add Comment
Please, Sign In to add comment