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
|
#include<iostream>
#include<string>
using namespace std;
int main()
{
char action, item1, item2;
int progress = 0;
bool a = true;
system("cls");
cout << "You are in a jail cell, for reasons irrelevant. You are trying to escape. Items and such: (w) thin brick wall dividing cells, (d) a wooden door with unbreakable lock, (b) bed, (p) firm plank. Press n for \"need help\", or the appropriate \naction button to act.\n";
do{
cin >> action;
switch (action)
{
case 'n':
cout << "Type u or to use an item on/with another item, the item's name to examine it (for example, look at bed, or l at c), or x for exit. ";
break;
case 'u':
cout << "Use what? ";
cin >> item1;
cout << "On what? ";
cin >> item2;
if(item1 == 'p' && item2 == 'b' && progress == 0)
{
cout << "You break off (m) a long, rigid piece of metal. ";
progress++;
}
else if(item1 == 'm' && item2 == 'w' && progress == 1)
{
cout << "After a minute of battering the wall, you break into a cell, and take (c) an iron candlestick, (f) a flint piece, and (t ) an unlit torch. ";
progress++;
}
else if(item1 == 'f' && item2 == 'c' && progress == 2)
{
cout << "You light the (t) torch. ";
progress++;
}
else if(item1 == 't' && item2 == 'd' && progress == 3)
{
a = false;
cout << "You burn down the door, and escape the jail! ";
}
else
cout << "You can't do that. ";
break;
case 'l':
{
cout << "Look at what? ";
cin >> item1;
switch(item1){
case 'w':
cout << "A thin brick wall, probably separating cells. ";
break;
case 'd':
cout << "A rigid, dry wood door, with a magically sealed lock. The door cannot be busted down. ";
break;
case 'b':
cout << "Your bed, with metal bars on the underside. ";
break;
case 'p':
cout << "A strong plank, which could be used as a crowbar. ";
break;
case 'm':
cout << "A piece of rather thick metal, broken off of your bed. ";
break;
case 'c':
cout << "A candlestick made of iron. The wax was burned away long ago. ";
break;
case 'f':
cout << "A small piece of broken flint. ";
break;
case 't':
if(progress == 2)
cout << "An unlit torch, not even used. ";
if(progress == 3)
cout << "A lit torch, which should last long. ";
break;
default:
cout << "That item doesn't exist. ";
}
case 'x':
a = false;
break;
default:
cout << "I do not understand that. Try a different syntax. ";
break;
}
cin.get();
cout << "Press ENTER to exit...\n";
cin.get();
return 0;
}
}while(a);
}
|