Guest User

Untitled

a guest
Feb 1st, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include<iostream>
  2. #include <string>
  3. #include <chrono>
  4. #include <thread>
  5.  
  6. using namespace std;
  7. using this_thread::sleep_for;
  8. using chrono::milliseconds;
  9.  
  10. string name, answer;
  11. void te(const string & message)
  12. {
  13.   for (const char letter: message)
  14.   {
  15.     cout << letter << flush;
  16.     sleep_for (milliseconds (25));
  17.   }
  18. }
  19. int main()
  20. {
  21.   te("Please enter your name."); cout << endl;
  22.   cin >> name;
  23.   te("Hello "); te(name); te (", are you ready to start the adventure?"); cout << endl;
  24.   cin >> answer;
  25.   if (answer == "YES" or answer == "Yes" or answer == "yes")
  26.   {
  27.     te ("Good! The game will start in:"); cout << endl;
  28.     cout << "3"; cout << endl;
  29.     sleep_for (milliseconds (1000));
  30.     cout << "2"; cout << endl;
  31.     sleep_for (milliseconds (1000));
  32.     cout << "1"; cout << endl;
  33.     sleep_for (milliseconds (1000));
  34.     te ("Surprise! We haven't finished it yet."); cout << endl;
  35.   }
  36.   else if (answer == "NO" or answer == "No" or answer == "no")
  37.   {
  38.     te ("What a shame! Come back when you're ready."); cout << endl;
  39.     sleep_for (milliseconds (1000));
  40.     te ("I'll be waiting for you, "); te (name); te ("!");
  41.   }
  42.   else
  43.   {
  44.     te ("I'm not prepared for all of your inputs, sorry.");
  45.   }
  46.   return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment