What its supposed to do is when you look at the closet you find the key and escape but if you dont check the cupboard you will die
(yeah yeah i know its random but shit)
but instead when it gets to the part where you choose it instantly skips to the end(after switch)
so wat do?
#include <iostream>
#include <string>
#define audrey 0
#define cupboard 0
usingnamespace std;
int main()
{
cout << "everything is so dark....." << endl;
cin.get();
cout << "\"HEY WAKE UP\"" << endl;
cin.get();
cout << "You open your eyes" << endl;
cin.get();
cout << "You find youself in a dark room" << endl;
cin.get();
cout << "You try to locate the voice but cant seem to find it.....";
cin.get();
cout << "\"EY TOSSER ON THE BLOODY CUPBOARD\"";
cin.get();
cout << "upon a quick look you realize that the voice is coming from a walkie talkie on" << endl << "the cupboard";
cin.get();
cout << "You pick up the walkie talkie" << endl;
cin.get();
cout << "smashing now what yer name?";
cout << "(press enter and Choose name)";
cin.get();
string Charname; //Char name
cin >> Charname;
cout << "well splendid " << Charname<< " " << endl;
cin.get();
cout << "ok now here's the deal" << endl;
cin.get();
cout << "look " << Charname << " this room is your prison" << endl;
cin.get();
cout << "and no there will be no food" << endl;
cin.get();
cout << "You can however escape from here" << endl;
cin.get();
cout << "find the key, get out good luck";
cin.get();
cout << "You start looking around the room,and see 3 places worth" << endl << "searching" << endl;
cout << "there is" << endl;
int Pindus;
teleport:
cout << "1 - a bed" << endl;
cout << "2 - a closet" << endl;
cout << "3 - a cupboard" << endl;
switch (Pindus)
{
case 1:
cout << "the bed look kinda comfy but really dusty";
goto teleport;
break;
case 2:
cout << "you open the closet and find a cute little plant" << endl;
cin.get();
cout << "you examine the plant when it suddenly starts to talk!"<< endl;
cin.get();
cout << "Feed me " << Charname << "and i'll give you whatever you whant";
cin.get();
cout << "you toss a bucket of fish you had in your backpocket the plant" << endl << "spat it out furiously knocking you over and closing the door";
cin.get();
cout << "you landed on top of the rug and felt something hard under the rug!";
cin.get();
cout << "with a sigh of relief you find the key under the rug and put it in" << endl << "your pocket" << endl;
cin.get();
#define audrey 1
break;
case 3:
cout << "This was a nice cupboard you might take it if you get out of here" << endl;
cin.get();
#define cupboard 1
goto teleport;
break;
};
if (audrey==cupboard);
{
cout << "you take the cupboard and shove it in your backpocket" << endl;
cin.get();
cout << "you run for the door filled with joy!" << endl;
cin.get();
cout << "you turn the key in the lock and feel how the door slowly opens" << endl;
cin.get();
cout << "you've escaped congratulations!";
cin.get();
return 0;
}
if (audrey > cupboard);
{
cout << "You run for the door filled with joy!" << endl;
cout << "You turn the key in the lock and feel how the door slowly opens" << endl;
cout << "but suddenly the door slams shut and you hear a voice from the closet" << endl << "\"\"" << Charname << "\"\"" << endl;
cout << "You did not escape..........";
cout << "Game over";
return 0;
};
}
#define is a preprocessor directive. The preprocessor runs before compilation takes place so it does not care about the C++ syntax or any scoping rules.
#define audrey 0 This just means that all occurrences of audrey should be replaced with 0 (You would get the same program if you just replaced all audrey with 0 in the code manually).
Use int variables for audrey and cupboard instead.