Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void printIntro();
- void printGuessAnswer();
- void printBar();
- void playGame();
- bool askToPlayAgain();
- int main()
- {
- do
- {
- printIntro();
- playGame();
- } while (askToPlayAgain());
- system("pause");
- return 0;
- }
- void playGame()
- {
- constexpr int enterTime = 5;
- for (int i = 0; i < enterTime; i++)
- {
- printGuessAnswer();
- printBar();
- }
- }
- void printIntro()
- {
- // print the fucking introduction of the fucking game
- constexpr int word_length = 5;
- cout << "Welcom to bullcow game\n";
- cout << "Can you guess the " << word_length;
- cout << " letter isogram that I am thinking about?\n";
- return;
- }
- void printGuessAnswer()
- {
- // print the guess's answer not pass the answer to the variable
- string x;
- cout << "enter your answer: ";
- do { getline(cin, x); } while(!x.size());
- cout << "your answer: " << x << endl;
- }
- void printBar()
- {
- // print the fucking bar
- cout << "--------------------------------------\n";
- }
- bool askToPlayAgain()
- {
- string str;
- cout << "Do you want to play again?(Y/N): ";
- cin >> str;
- return (str[0] == 'y' || str[0] == 'Y');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement