Here is the C++ code of this project.
#include <iostream>
#include <string>
using namespace std;
int main()
{ string arr [10];
int game=1, l=0, area=100, bottle=0, shovel=0, potion=0, milk=0, keygrave=0, keybasement=0, bone=0, courage=0, hole=0, bottlehad=0, win=0;
string a;
cout << "You wake up outside, surrounded by tall green trees. A little too green..." << endl; // Intro
//BEGIN 1 //
while (area==100)
{
cout << "\n Should you inspect a tree?" << endl;
cin >> a;
if (a=="yes") // YES
{
cout << "\n WOW!!!!! A big hairy foot with claws stepped where you woke up! Good thing you moved! Do you still want to inspect the tree?" << endl;
area=101;
}
else if (a=="no") // NO
{
cout << "\n You got stepped on by a big hairy foot! THE END" << endl;
area=-100;
}
else if (a=="xyzzy") // NO
{
cout << "\n Hehehe... \n\n funny." << endl;
}
else
{
cout << " " << endl;
}
}
// BEGIN 2 //
while (area==101)
{
cin >> a;
if (a=="yes") // YES
{
cout << "\n It's really tall and thin. It waves in the wind. What do you think it is?" << endl;
area=102;
}
else if (a=="no") // NO
{
cout << "\n You stand the in the the forest, your life has no purpose. THE END" << endl;
area=-100;
}
else
{
cout << " " << endl;
}
}
//FRONT YARD GRASS RIDDLE//
while (area==102)
{
cin >> a;
cout << "\n It's grass! How did it get so big? Or how did you get so small!" << endl;
cout << "\n You find a notebook. Type 'add' to add a note to your notepad or type 'check' to look at your notes. Don't waste the notes! The notebook only has 10 lines. Make sure each note is written in one word." << endl;
area=0;
}
while (area != -100)
{
//FRONT YARD 0//
while (area==0)
{
cout << "\n You can go north to the house or east to a tree." << endl;
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="north") // Go to house
{
if (shovel==1)
{
cout << "\n You're in the foyer. You can go: North, up, down, or south." << endl;
area=2;
}
else if (shovel==0)
{
cout << "\n You walk through the open door.\n There is a shovel.\n Type 'shovel' to pick it up. You can go: North, up, down, or south" << endl;
area=2;
}
}
else if (a=="east") // Go to tree
{
if (bottlehad==0)
{
cout << "\n There is a bottle of milk that is your size. Type 'bottle' to pick it up. You can go: West" << endl;
area=1;
}
else if (bottlehad==1)
{
cout << "\n you are near a tree. You can go: West." << endl;
area=1;
}
else
{
cout << " " << endl;
}
}
else if (a=="dig" && shovel==1) // Dig
{
if (hole==0)
{
cout << "\n You found a bone!" << endl;
bone=1;
hole=1;
}
else if (hole==1)
{
cout << "\n You killed yourself trying to dig nothing. THE END" << endl;
area=-100;
}
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
// TREE 1//
while (area==1)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="bottle") // Pick up bottle
{
if (bottlehad==0)
{
cout << "\n This is cat milk!" << endl;
bottle=1;
milk=1;
bottlehad=1;
}
else if (bottlehad==1)
{
cout << "\n The bottle has been taken already." << endl;
}
}
else if (a=="west") // Go to front yard
{
cout << " " << endl;
area=0;
}
else if (a=="dig" && shovel==1) // Dig
{
cout << "\n You tapped into a secret testing facility FILLED with...\n\n\n DONUTS SHAPED LIKE WAFFLES!!!!!!! \n\n\n\n YOU WIN!!!" << endl;
area = -1;
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
// HOUSE FOYER 2//
while (area==2)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="shovel") // get shovel
{
if (shovel==0)
{
cout << "\n You can now dig holes in the ground!" << endl;
shovel=1;
}
else if (shovel==1)
{
cout << "\n You already took the shovel." << endl;
}
}
else if (a=="up") // go to attic
{
if (courage==0)
{
cout << "\n You are to scared to enter the attic!" << endl;
}
else if (courage==1 && keybasement==0)
{
cout << "\n You burst the door open, launching it across the room! \n You pick up a key! You can go: down." << endl;
area=5;
keybasement=1;
}
else if (courage==1 && keybasement==1)
{
cout << "\n There is nothing in here anymore." << endl;
area=5;
}
}
else if (a=="down") // Go to front yard
{
if (keybasement==0)
{
cout << "\n The basement is locked." << endl;
}
else if (keybasement==1)
{
cout << " There is a giant shrink ray and a mad scientist!\n Type 'shrink' to shrink him and unsrink yourself!" << endl;
area=6;
}
}
else if (a=="south") // Go to front yard
{
cout << " " << endl;
area=0;
}
else if (a=="north") // Go to front yard
{
cout << "\n You're in the kitchen. There is a bowl on the floor. If you have milk you should pour it! You can go: East or south" << endl;
area=3;
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
// KITCHEN 3//
while (area==3)
{
if (bone==1 && bottle==1)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="pour" && bottle==1) // Pour milk
{
cout << "\n A dog comes to drink the milk. \n\n 'RUFF!' \n\n Translation: Find my bone! I lost it!" << endl;
bottlehad = 1;
bottle = 0;
}
else if (a=="south") // Go to foyer
{
if (shovel==1)
{
cout << "\n You're in the foyer. You can go: North, up, down, or south." << endl;
area=2;
}
else if (shovel==0)
{
cout << "You are in the foyer.\n There is a shovel.\n Type 'shovel' to pick it up. You can go: North, up, down, or south" << endl;
area=2;
}
}
else if (a=="east") // Go to Grave
{
if (keygrave=0)
{
if (courage==0)
{
cout << "\n The door is locked!" << endl;
courage=1;
area=4;
}
}
if (keygrave=1)
{
if (courage==0)
{
cout << "\n You entered a grave! who has a door to a grave in there kitchen? Anyway, the sight of dead people built up your courage!" << endl;
courage=1;
area=4; // Get in grave
}
else if (courage==1)
{
cout << "\n You're so courageous that you burn the grave... \n \n and the house. THE END" << endl;
area = -100; // Burn Grave
}
}
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
else if (bone==1 && bottle==0 && bottlehad==1)
{
cout << "\n 'RUFF' \n \n Translation: Thank you! here is a key!" << endl;
keygrave=1;
bone=0; // give bone
}
else
{
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="pour" && bottle==1 && bone==0) // Pour milk
{
cout << "\n A dog comes to drink the milk. \n\n 'RUFF!' \n\n Translation: Find my bone! I lost it!" << endl;
bottlehad = 1;
bottle = 0;
}
else if (a=="south") // Go to foyer
{
if (shovel==1)
{
cout << "\n You're in the foyer. You can go: North, up, down, or south." << endl;
area=2;
}
else if (shovel==0)
{
cout << "You are in the foyer.\n There is a shovel.\n Type 'shovel' to pick it up. You can go: North, up, down, or south" << endl;
area=2;
}
}
else if (a=="east") // Go to Grave
{
if (keygrave=0)
{
if (courage==0)
{
cout << "\n The door is locked!" << endl;
courage=1;
area=4;
}
}
if (keygrave=1)
{
if (courage==0)
{
cout << "\n You entered a grave! who has a door to a grave in there kitchen? Anyway, the sight of dead people built up your courage!" << endl;
courage=1;
area=4; // go to grave
}
else if (courage==1)
{
cout << "\n You're so courageous that you burn the grave... \n \n and the house. THE END" << endl;
area = -100; // burn grave
}
}
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
}
}
// GRAVE 4//
while (area==4)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="west") // Go to kitchen
{
cout << "\n You're in the kitchen. You can go: East or south." << endl;
area=3;
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
// ATTIC 5 //
while (area==5)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="down") // Go to foyer
{
cout << "\n You're in the foyer. You can go: North, up, down, or south." << endl;
area=2;
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
// BASEMENT 6 //
while (area==6)
{
cin >> a;
if (a=="add" && l<10) // add one note
{
cout << "\n write your note." << endl;
cin >> arr [l];
l=l+1;
}
else if (a=="check") // print all notes
{
cout << " 1." << arr[0] << " 2." << arr[1] << " 3." << arr[2] << " 4." << arr[3] << " 5." << arr[4] << " 6." << arr[5] << " 7." << arr[6] << " 8." << arr[7] << " 9." << arr[8] << " 10." << arr[9] << endl;
}
else if (a=="up") // Go to foyer
{
cout << "\n You're in the foyer. You can go: North, up, down, or south." << endl;
area=2;
}
else if (a=="shrink") // WIN
{
cout << "\n\n\n CONGRADULATIONS!!! \n\n\n YOU WIN!!!!!!!" << endl;
cout << "\n\n\n\n\n\n\n\n You're still in the basement though! \n\n Try to find the secret area!" << endl;
}
else if (a=="add") // NO MORE NOTES
{
cout << "\n Sorry, no more notes!" << endl;
}
else
{
cout << " " << endl;
}
}
}
}
Last edited by johndo77 (2010-10-03 21:15:22)
Offline
Offline
johndo77 wrote:
ThePCKid wrote:
I'm compiling a .EXE file
![]()
I bet it's still compiling.
No
Offline