Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <string>
- #include <chrono>
- #include <thread>
- using namespace std;
- using this_thread::sleep_for;
- using chrono::milliseconds;
- string name, answer;
- void te(const string & message)
- {
- for (const char letter: message)
- {
- cout << letter << flush;
- sleep_for (milliseconds (25));
- }
- }
- int main()
- {
- te("Please enter your name."); cout << endl;
- cin >> name;
- te("Hello "); te(name); te (", are you ready to start the adventure?"); cout << endl;
- cin >> answer;
- if (answer == "YES" or answer == "Yes" or answer == "yes")
- {
- te ("Good! The game will start in:"); cout << endl;
- cout << "3"; cout << endl;
- sleep_for (milliseconds (1000));
- cout << "2"; cout << endl;
- sleep_for (milliseconds (1000));
- cout << "1"; cout << endl;
- sleep_for (milliseconds (1000));
- te ("Surprise! We haven't finished it yet."); cout << endl;
- }
- else if (answer == "NO" or answer == "No" or answer == "no")
- {
- te ("What a shame! Come back when you're ready."); cout << endl;
- sleep_for (milliseconds (1000));
- te ("I'll be waiting for you, "); te (name); te ("!");
- }
- else
- {
- te ("I'm not prepared for all of your inputs, sorry.");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment