Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int state{ 1 };
  6.  
  7. int main()
  8. {
  9. do {
  10.  
  11. if (state == 1) {
  12. char firstChoice;
  13. cout << "Welcome to your story! You woke up in the middle of an abandoned town. You have two choices. They are: \n A) Explore the town for resources or B) Try to leave town \n";
  14. cin >> firstChoice;
  15.  
  16. if (firstChoice == 'A' || firstChoice == 'a') {
  17. state = 2;
  18. }
  19.  
  20. else if (firstChoice == 'B' || firstChoice == 'b') {
  21. state = 3;
  22.  
  23. }
  24. }
  25.  
  26. else if (state == 2) {
  27. char secondChoice;
  28. cout << "You've decided to explore the abandoned town! Here are your choices! You can take \n A) Medicial Supplies or B) Weapons for survival \n";
  29. cin >> secondChoice;
  30.  
  31. if (secondChoice == 'A' || secondChoice == 'a') {
  32. state = 4; //Medicial Supplies
  33. }
  34.  
  35. else if (secondChoice == 'B' || secondChoice == 'b') {
  36. state = 5; //Weapons for survival
  37. }
  38. }
  39.  
  40. if (state == 3) {
  41. char otherChoice;
  42. cout << "You've decided to leave town! GAME OVER! Would you like to try again? Y/N? \n"; //GAME OVER
  43. cin >> otherChoice;
  44.  
  45. if (otherChoice == 'Y' || otherChoice == 'y') {
  46. state = 1;
  47. }
  48. else {
  49. state = 0;
  50. }
  51. }
  52.  
  53. else if (state == 4) {
  54. char thirdChoice;
  55. cout << "You decided to take Medicial Supplies! Here are your next choices! \n Do you want to: A) Continue exploring the town or B) Find a working car? \n";
  56. cin >> thirdChoice;
  57. if (thirdChoice == 'A' || thirdChoice == 'a') {
  58. state = 6; //Continue Exploring
  59. }
  60.  
  61. else if (thirdChoice == 'B' || thirdChoice == 'b') {
  62. state = 7; //Find a working car
  63. }
  64. }
  65.  
  66. if (state == 5) {
  67. char fourthChoice;
  68. cout << "You've decided to look for weapons! Would you like to: A) Go hunt for food or B) Camp out? \n";
  69. cin >> fourthChoice;
  70.  
  71. if (fourthChoice == 'A' || fourthChoice == 'a') {
  72. state = 8; //Hunt for food
  73. }
  74. else if (fourthChoice == 'B' || fourthChoice == 'b') {
  75. state = 9; //Camp Out
  76. }
  77. }
  78.  
  79. if (state == 6) {
  80. char otherChoice;
  81. cout << "You decided to explore the town! Unfortunately, there was a trap and you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
  82. cin >> otherChoice;
  83.  
  84. if (otherChoice == 'Y' || otherChoice == 'y') {
  85. state = 1;
  86. }
  87. else {
  88. state = 0;
  89. }
  90. }
  91.  
  92. if (state == 7) {
  93. char fifthChoice;
  94. cout << "You decided to look for a working car! Sadly, it doesn't work... What would you do? \n A) Find Shelter or B) Hot Wire the Car \n";
  95. cin >> fifthChoice;
  96.  
  97. if (fifthChoice == 'A' || fifthChoice == 'a') {
  98. state = 14; //Find Shelter
  99. }
  100.  
  101. else if (fifthChoice == 'B' || fifthChoice == 'b') {
  102. state = 15; //Hot Wire the Car
  103.  
  104. }
  105. }
  106.  
  107. if (state == 8) {
  108. char sixthChoice;
  109. cout << "You've decided to to hunt for food and you encounter a Zombie! Would you like to: A) Aim for the head or B) Let it kill you? \n";
  110. cin >> sixthChoice;
  111.  
  112. if (sixthChoice == 'A' || sixthChoice == 'a') {
  113. state = 10; //Aim for the head
  114. }
  115. else if (sixthChoice == 'B' || sixthChoice == 'b') {
  116. state = 11; //Let it kill you
  117. }
  118. }
  119.  
  120. if (state == 9) {
  121. char otherChoice;
  122. cout << "You've decided to camp out! You encounter a werewolf! Would you like to: A) Kill it and make dinner out of it or B) Let it kill you? \n";
  123. cin >> otherChoice;
  124.  
  125. if (otherChoice == 'A' || otherChoice == 'a') {
  126. state = 12; //Kill and make dinner
  127. }
  128. else if (otherChoice == 'B' || otherChoice == 'b') {
  129. state = 13; //Let it kill you
  130. }
  131. }
  132.  
  133. if (state == 10) {
  134. char otherChoice;
  135. cout << "You decided to aim for the head! Unfortunately, the zombie killed you and you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
  136. cin >> otherChoice;
  137.  
  138. if (otherChoice == 'Y' || otherChoice == 'y') {
  139. state = 1;
  140. }
  141. else {
  142. state = 0;
  143. }
  144. }
  145.  
  146.  
  147. if (state == 11) {
  148. char otherChoice;
  149. cout << "You decided to let the zombie kill you! Unfortunately, you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
  150. cin >> otherChoice;
  151.  
  152. if (otherChoice == 'Y' || otherChoice == 'y') {
  153. state = 1;
  154. }
  155. else {
  156. state = 0;
  157. }
  158. }
  159.  
  160. if (state == 12) {
  161. char otherChoice;
  162. cout << "You decided to kill the werewolf and made dinner. Unfortunately, You got sick and died in your sleep. Would you like to try again? Y/N? \n"; //GAME OVER
  163. cin >> otherChoice;
  164.  
  165. if (otherChoice == 'Y' || otherChoice == 'y') {
  166. state = 1;
  167. }
  168. else {
  169. state = 0;
  170. }
  171. }
  172.  
  173. if (state == 13) {
  174. char otherChoice;
  175. cout << "You decided to let the werefolf kill you! Unfortunately, you'd died! Would you like to try again? Y/N? \n"; //GAME OVER
  176. cin >> otherChoice;
  177.  
  178. if (otherChoice == 'Y' || otherChoice == 'y') {
  179. state = 1;
  180. }
  181. else {
  182. state = 0;
  183. }
  184. }
  185.  
  186. if (state == 14) {
  187. char otherChoice;
  188. cout << "You decided to look for shelter! You decided to sleep. Would you like to try again? Y/N? \n"; //GAME OVER
  189. cin >> otherChoice;
  190.  
  191. if (otherChoice == 'Y' || otherChoice == 'y') {
  192. state = 1;
  193. }
  194. else {
  195. state = 0;
  196. }
  197. }
  198.  
  199.  
  200. if (state == 15) {
  201. char otherChoice;
  202. cout << "You decided to hot wire the car! Congratulations! You successful made it out the abandoned town! Would you like to play again? Y/N? \n"; //GAME OVER
  203. cin >> otherChoice;
  204.  
  205. if (otherChoice == 'Y' || otherChoice == 'y') {
  206. state = 1;
  207. }
  208. else {
  209. state = 0;
  210. }
  211. }
  212.  
  213. } while (state != 0);
  214. cout << state;
  215. return 0;
  216. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement