#include "stdafx.h" #include "iostream" #include "fstream" #include "time.h" #include "string" #include // Required for 'getch' and 'putch' #include using namespace std; #define KEY_LEFT 75 #define KEY_RIGHT 77 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); string chosenOption = ""; void Scene03(); string ChooseOption(string question, string option1, string option2) { char dummy = ' '; string selectedOption; cout << question << "\n\n"; cout << " "; SetConsoleTextAttribute(hConsole, 240); cout << option1; SetConsoleTextAttribute(hConsole, 15); cout << " | " << option2; cout << '\xd'; selectedOption = option1; do { dummy = getch(); switch (dummy) { case (KEY_LEFT): { cout << " "; SetConsoleTextAttribute(hConsole, 240); cout << option1; SetConsoleTextAttribute(hConsole, 15); cout << " | " << option2; cout << '\xd'; selectedOption = option1; break; } case (KEY_RIGHT): { cout << " "; cout << option1 << " | "; SetConsoleTextAttribute(hConsole, 240); cout << option2; SetConsoleTextAttribute(hConsole, 15); cout << '\xd'; selectedOption = option2; break; } } } while (dummy != 13); cout << "\n\n"; return selectedOption; } void Scene20() { cout << "You make a spectacular jump, catching the bird squarely in your\n" << "mouth. Your owner is amazed at your skills, and you win \"Dogs\n" << "Got Talent\". You're the best dog in the world. The End!\n\n"; // End } void Scene21() { cout << "Your owner shoots the bird and you go and retrieve it. Your\n" << "owner is satisfied with the kill and you both go home satisfied.\n" << "The End!\n\n"; // End } void Scene14() { cout << "Your owner shoots the bird and, while you are retrieving\n" << "the bird, your owner thinks the bird is still alive, so\n" << "he fires at the bird a second time, not knowing that it\n" << "is in your mouth.\n\nTo be continued...\n\n"; // End } void Scene13() { cout << "You jump and reach for the bird. While you are in\n" << "mid air with the bird in your mouth, your owner\n" << "pulls the trigger because he can't see you in your\n" << "camo outfit.\n\nTo be continued...\n\n"; // End } void Scene11() { cout << "Your owner puts the neon outfit on you and you go out\n" << "hunting. You see a bird fly really low to the ground.\n" << "You can jump and get it, or wait for your owner to shoot.\n\n"; chosenOption = ChooseOption("What do you want to do? ", "jump", "wait"); if (chosenOption == "jump") Scene20(); if (chosenOption == "wait") Scene21(); } void Scene12() { cout << "Your owner puts the camo outfit on you and you go out\n" << "hunting. You see a bird fly really low to the ground.\n" << "You can jump and get it, or wait for your owner to shoot.\n\n"; chosenOption = ChooseOption("What do you want to do? ", "jump", "wait"); if (chosenOption == "jump") Scene13(); if (chosenOption == "wait") Scene14(); } void Scene10() { cout << "You are a hunting dog living in the country with your\n" << "owner. Your owner picks up two outfits: a neon one\n" << "and a camo one.\n\n"; chosenOption = ChooseOption("Which outfit do you want? ", "neon", "camo"); if (chosenOption == "neon") Scene11(); if (chosenOption == "camo") Scene12(); } void Scene09() { cout << "After about one minute, your owner comes out with your\n" << "food. You are satisfied with your breakfast. The End!\n\n"; // End } void Scene07() { cout << "You are at the elevator. However, you find that, being\n" << "a cat, you cannot reach the buttons to call the elevator\n" << "to your floor. After wasting five minutes, you return to\n" << "your apartment to find that the mouse has run off. Your\n" << "only options are to get the neighbor's bird or wait until\n" << "your owner wakes up.\n\n"; chosenOption = ChooseOption("What do you want to do? ", "get the bird", "wait for breakfast"); if (chosenOption == "wait for breakfast") Scene09(); if (chosenOption == "get the bird") Scene03(); } void Scene03() { cout << "You go to the balcony and try to pounce on the bird.\n" << "You miss and the bird flies away, but because you\n" << "jumped too far, you fly over the balcony and start\n" << "to fall to the ground.\n\nTo be continued...\n\n"; // End } void Scene06() { cout << "You walk down the stairs and get out onto the street.\n" << "You see the mouse on the other side. You run across\n" << "the street, and as you do you look to your right and\n" << "see a taxi coming closer.\n\nTo be continued...\n\n"; // End } void Scene05() { cout << "You have to get down to the street quickly, before everybody\n" << "has to go to work. The building has an elevator and a\n" << "staircase.\n\n"; chosenOption = ChooseOption("Choose your path: ", "elevator", "staircase"); if (chosenOption == "elevator") Scene07(); if (chosenOption == "staircase") Scene06(); } void Scene02() { cout << "You wake up in an apartment in Manhatan on the 5th floor.\n" << "It is 5:45 AM and your owner hasn't woken up yet to give\n" << "you breakfast and you're really hungry. On your balcony\n" << "you see your neighbor's pet bird, and on the street below\n" << "you see a mouse.\n\n"; chosenOption = ChooseOption("Choose your breakfast: ", "bird", "mouse"); if (chosenOption == "mouse") Scene05(); if (chosenOption == "bird") Scene03(); } void Scene01() { chosenOption = ChooseOption("Select your character: ", "cat", "dog"); if (chosenOption == "cat") Scene02(); if (chosenOption == "dog") Scene10(); } void main() { cout << " WELCOME TO \n\n SELECT YOUR FATE\n\n\n"; Scene01(); }