Advertisement
zCool

Choose your own adventure

May 4th, 2012
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int choiceOne;
  7. int choiceTwo;
  8. int choiceThree;
  9.  
  10. cout << "Welcome To Choose Your Own Adventure"
  11.      <<"\n"
  12.      << "------------------------------------"
  13.      << "\n\n"
  14.      << "You awaken, groggy from  lack of sleep.  "
  15.      << "Your eyes slowly adjust to the sunlight "
  16.      << "coming through the window shades.  "
  17.      << "It is at this point that you notice the "
  18.      << "shrill sound of the alarm clock buzzing "
  19.      << "in your ears.  "
  20.      << "Resolving yourself to take action you decide to..."
  21.      << "\n"
  22.      << "1 - Hit the Snooze Button."
  23.      << "\n"
  24.      << "2 - Turn off the Alarm."
  25.      << "\n"
  26.      << "Select an option: ";
  27. while(true)
  28. {
  29.     if(cin >> choiceOne)
  30.     {
  31.         if(choiceOne != 1 && choiceOne != 2)
  32.         {
  33.             cin.clear();
  34.             cin.ignore();
  35.             cout << "Please pick 1 or 2:  ";
  36.  
  37.         }
  38.         else
  39.         {
  40.             break;
  41.         }
  42.     }
  43.     else
  44.     {
  45.         cin.clear();
  46.         cin.ignore();
  47.         cout << "Sorry I didn't get that please pick "
  48.              << "option 1 or 2. \n";
  49.     }
  50. }
  51.  
  52. while (true)
  53. {
  54.     //Snooze  
  55.     if (choiceOne == 1)
  56.     {
  57.         cout << "You hit the snooze button and fall back asleep.  \n"
  58.              << "Good night...zzzz... "
  59.              << "Thanks for playing\n";
  60.              break;
  61.     }
  62.  
  63.     //Turn off alarm
  64.     if (choiceOne == 2)
  65.     {
  66.         cout << "You reluctantly get out of bed and turn off the alarm \n"
  67.              << "May as well get ready for work you think to yourself \n"
  68.              << "Resolving yourself to take action you decide to first - "
  69.              << "\n"
  70.              << "1 - Take a shower. \n"
  71.              << "2 - Make breakfast. \n"
  72.              << "Select an option: ";
  73.        
  74.         while(true)
  75.         {
  76.             if(cin >> choiceTwo)
  77.             {
  78.                 if(choiceTwo != 1 && choiceTwo != 2)
  79.                     {
  80.                         cin.clear();
  81.                         cin.ignore();
  82.                         cout << "Please pick 1 or 2:  ";
  83.  
  84.                     }
  85.                     else
  86.                     {
  87.                         break;
  88.                     }
  89.                 }
  90.                 else
  91.                 {
  92.                     cin.clear();
  93.                     cin.ignore();
  94.                     cout << "Sorry I didn't get that please pick "
  95.                          << "option 1 or 2. \n";
  96.                 }
  97.             }
  98.     }
  99.  
  100.     //shower
  101.     if (choiceTwo == 1)
  102.     {
  103.         cout << "You decide to take a shower first."
  104.              << "While stepping into the tub, you slip and fall."
  105.              << "Good night... zzzz.  Thanks for playing. \n";
  106.         break;
  107.     }
  108.  
  109.     //breakfast
  110.     if(choiceTwo == 2)
  111.     {
  112.         cout << "You decide to head to the kitchen and make yourself a healthy breakfast \n"
  113.              << "but you get lazy and settle for a couple of poptarts and a half empty bottle \n"
  114.              << "of mountain dew code red (exp. date unknown.) \n"
  115.              << "Ahh, delicious, you think as you finish breakfast, almost ready for work. \n"
  116.              << "Resolving yourself to take action you decide to-"
  117.              << "\n"
  118.              << "1 - Get in the car and drive straight to work. \n"
  119.              << "2 - Get in the car and drive to work but stop for a lottery ticket. \n"
  120.              << "Select an option: ";
  121.        
  122.         while(true)
  123.         {
  124.             if(cin >> choiceThree)
  125.             {
  126.                 if(choiceThree != 1 && choiceThree != 2)
  127.                     {
  128.                         cin.clear();
  129.                         cin.ignore();
  130.                         cout << "Please pick 1 or 2:  ";
  131.  
  132.                     }
  133.                     else
  134.                     {
  135.                         break;
  136.                     }
  137.                 }
  138.                 else
  139.                 {
  140.                     cin.clear();
  141.                     cin.ignore();
  142.                     cout << "Sorry I didn't get that please pick "
  143.                          << "option 1 or 2. \n";
  144.                 }
  145.             }
  146.  
  147.         //straight to work
  148.         if(choiceThree == 1)
  149.         {
  150.             cout << "You hop in your car and drive to work. \n"
  151.                  << "Nothing unusual happens. \n"
  152.                  << "You win ???? \n";
  153.             break;
  154.         }
  155.  
  156.         if(choiceThree == 2)
  157.         {
  158.             cout << "You hop in your car and drive to work. \n "
  159.                  << "But first you stop for an ultrabillions lottery ticket. \n  "
  160.                  << "A week later you hear the drawing, you won!! \n"
  161.                  << "However, soon after you take a victory shower and fall unconscious \n"
  162.                  << "Good night... zzzz.  Thanks for playing. \n";
  163.             break;
  164.         }
  165.  
  166.     }
  167.  
  168. }
  169. system("PAUSE");
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement