1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include <chrono>
#include <thread>
#include <iostream>
struct slowly_printing_string { std::string data; long int delay; };
std::ostream& operator<<(std::ostream& out, const slowly_printing_string& s) {
for (const auto& c : s.data) {
out << c << std::flush;
std::this_thread::sleep_for(std::chrono::milliseconds(s.delay));
}
return out;
using namespace std;
int main()
{
string answer;
string movement;
cout << slowly_printing_string{ "You are walking through a deep, and dark passageway\ntype N then press enter to continue\n",100};
cin >> answer;
if ("N" == answer)
{
cout <<"You come across a right turn, press D to turn right, or press W to continue straight\n";
cin >> answer;
if ("D" == answer)
{
cout <<
"YOUCH!\n You activated a tripwire coming around the corner, it dropped a log on you!\nYOU DIED!";
}
else if ("W" == answer)
{
cout <<
"You continue through the passageway, but something is out of the ordinary, \nyou hear screaming coming closer behind you! R to run as fast as you can, and 'I' to investigate what it is\n";
cin >> answer;
if ("R" == answer)
{
cout <<
"You run as fast as you can but it catches up to you, as it\n";
}
else if ("I" == answer)
{
cout <<
"you wirl around and stare at the burned creature, as it\n";
}
cout <<
"leaps at you, you feel your soul draining. as it drips wet flesh onto you.\n You manage to grip a rock to your left, press H to hit the monster with the rock, press C to let the monster continue stealing your soul\n";
cin >> answer;
if ("H" == answer)
{
cout <<
"you slam the rock onto the monsters skull, he whips back and shreaks\n You get up and run as fast as you can down the passageway, still holding the rock you hear the monster screaming up the hall, you see a doorway in a the distance\n should you throw the rock at the monster, or keep hold? H to keep hold and T to throw the rock\n";
cin >> answer;
if ("H" == answer)
{
cout <<
"you keep hold of the rock, as the monster scratches it's way down the hall running towards you, the doorway comes closer. Do you enter it Y for yes N for no\n";
cin >> answer;
if ("Y" == answer)
{
cout <<
"you clear the doorway, and the monster flies by\nyou look around the room, and realize your in an old dungeon. press I to look around room, and H to hide\n";
cin >> answer;
}
else if ("N" == answer)
{
}
else if ("T" == answer)
{
}
}
}
else if (answer != "N")
{
while (answer != "N")
{
cout << "Invalid input, please restart program.";
}
}
return 0;
}
}
}
}
|