Created
October 15, 2012 06:07
-
-
Save itsjohncs/3891020 to your computer and use it in GitHub Desktop.
CS 10 SI Lab Session 3 - CYOA Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() { | |
| cout << "You wake up to find yourself in the entry hall of a mansion. " | |
| "There are two doors in the hall, one leading outside, another " | |
| "leads further into the mansion.\n" | |
| "\t1) Go outside\n" | |
| "\t2) Go further into the mansion\n" | |
| "Select an option: "; | |
| int choice = 0; | |
| cin >> choice; | |
| if (choice == 1) { | |
| cout << "\nYou step outside only to find that the mansion was " | |
| "suspended miles up in the air. You fall for a few minutes " | |
| "before making spectacular contact with the ground.\n" | |
| "\n-- You Have Died -- Game Over --\n"; | |
| } else if (choice == 2) { | |
| cout << "\nYou walk into the mansion and see a number of frightening " | |
| "paintings. After walking by a particularly life-like painting " | |
| "of a moose, it jumps out of the painting and kicks you in the " | |
| "face with it's forelegs. You manage to scramble to your feet " | |
| "quickly and run down the hall while the moose pursues you. " | |
| "As you look back, you can see the murder in its eyes. You see " | |
| "a pair of doors on either side of the hallway.\n" | |
| "\t1) Go into the one on the left\n" | |
| "\t2) Go into the one on the right\n" | |
| "Select an option: "; | |
| cin >> choice; | |
| if (choice == 1) { | |
| cout << "\nThe door is locked. As you scramble to get it open, the " | |
| "moose catches up to you and kills you.\n" | |
| "\n-- You Have Died -- Game Over --\n"; | |
| } else if (choice == 2) { | |
| cout << "\nYou burst through the door on the right and manage to " | |
| "close it before the moose can follow you through. As you " | |
| "lean against the door bracing for the moose's onslaught " | |
| "on the door, seconds pass. Then a full minute. You notice " | |
| "the moose is not trying to break through the door. " | |
| "Turning around releived, you notice you are in a dungeon " | |
| "with a single torch burning in the corner.\n" | |
| "\t1) Examine the dungeon\n" | |
| "\t2) Go back out of the dungeon\n" | |
| "\t3) Crawl up in a ball and cry\n" | |
| "Select an option: "; | |
| cin >> choice; | |
| if (choice == 1) { | |
| cout << "\nAs you step further into the dungeon, you hear a " | |
| "hardly audible click. Before you are able to react, a " | |
| "large boulder falls on top of you.\n" | |
| "\n-- You Have Died -- Game Over --\n"; | |
| } else if (choice == 2) { | |
| cout << "\nYou open the door to go back outside and you are " | |
| "met with the sight of a charging moose. Before you " | |
| "can think to yourself \"Oh yeah, there's a moose out " | |
| "here\" the moose smashes into you.\n" | |
| "\n-- You Have Died -- Game Over --\n"; | |
| } else if (choice == 3) { | |
| cout << "\nAs you roll around on the floor bawling, you hear a " | |
| "hardly audible click. Before you are able to react, a " | |
| "massive statue of a moose falls on top of you.\n" | |
| "\n-- You Have Died -- Game Over --\n"; | |
| } | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment