Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
63
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. #include <Windows.h>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. char choice;
  10.  
  11. int main()
  12. {
  13. char name[20];
  14. int coins = 0;
  15. string question1;
  16. int question2 = 0;
  17.  
  18. cout << "Instructions:";
  19. cout << "\n";
  20. cout << "Solve the 6 puzzles and collect as many coins as you can and the final treasure in the center of the tomb.";
  21. cout << "\n";
  22.  
  23. system("PAUSE");
  24. system("cls");
  25.  
  26. cout << "\t\t\t----------Adventure Game----------";
  27.  
  28. do
  29. {
  30.  
  31. cout << "\n\t\t\t--------------------------------";
  32. cout << "\n\t\t\t1. Adventure Game";
  33. cout << "\n\t\t\t2. Help";
  34. cout << "\n\t\t\t3. Exit";
  35. cout << "\n\t\t\t--------------------------------";
  36. cout << "\n\t\t\tPlease Enter 1, 2, or 3: ";
  37.  
  38. cin >> choice;
  39. switch (choice)
  40. {
  41. case '1': if (choice == '1')
  42. {
  43.  
  44. cout << "You are a lone adventurer, you stumble upon a large ancient tomb" << "\n" << "You must solve the puzzles on the 7 doors to get to the treasure";
  45. cout << "\n";
  46. system("PAUSE");
  47. system("cls");
  48.  
  49. cout << "Please enter your name: ";
  50. cin >> name;
  51.  
  52. cout << "\nWelcome " << name;
  53. system("cls");
  54.  
  55. cout << name << " approaches door number 1";
  56. cout << "\nSolve the following puzzle: ";
  57.  
  58. cout << "\n\nWhat is 12 X 12?";
  59. cin >> question2;
  60.  
  61. if (question2 == 144)
  62. {
  63. cout << "You hear a click and the door opens and you grab a coin...";
  64. cout << "\n";
  65. coins++;
  66. system("PAUSE");
  67.  
  68. }
  69.  
  70. else if (question2 != 144)
  71. {
  72. cout << "You triggered the trap and the coin disappears";
  73. cout << "\n";
  74.  
  75. system("PAUSE");
  76.  
  77. }
  78. system("cls");
  79.  
  80. cout << "You move on and you see another door" << endl;
  81. cout << name << " approaches door number 2..";
  82.  
  83. cout << "\nWhich countries flag has black, red and yellow horizontally?";
  84. cin >> question1;
  85.  
  86. if (question1 == "Germany")
  87. {
  88. cout << "You hear a click and the door opens and you grab a coin...";
  89. cout << "\n";
  90. Sleep(2500);
  91. coins++;
  92.  
  93. }
  94.  
  95. else if (question1 != "Germany")
  96. {
  97. cout << "You triggered the trap and the coin disappears";
  98. cout << "\n";
  99.  
  100. system("PAUSE");
  101.  
  102. }
  103.  
  104. system("cls");
  105.  
  106. cout << "You move on and you see another door" << endl;
  107. cout << name << " approaches door number 3..";
  108. cout << "\n How many sides does a septagon have?";
  109. cin >> question2;
  110.  
  111. if (question2 == 7)
  112. {
  113. cout << "You hear a click and the door opens and you grab a coin...";
  114. cout << "\n";
  115. coins++;
  116. Sleep(2500);
  117. }
  118. else if (question2 != 7)
  119. {
  120. cout << "You triggered the trap and the coin disappears";
  121. cout << "\n";
  122.  
  123. system("PAUSE");
  124.  
  125. }
  126.  
  127. system("cls");
  128.  
  129. cout << "You move on and you see another door" << endl;
  130. cout << name << " approaches door number 4..";
  131. cout << "\n How many letters are in the alphabet?";
  132. cin >> question2;
  133.  
  134. if (question2 == 26)
  135. {
  136.  
  137. cout << "You hear a click and the door opens and you grab a coin...";
  138. cout << "\n";
  139. coins++;
  140. Sleep(2500);
  141. }
  142. else if (question2 != 26)
  143. {
  144. cout << "You triggered the trap and the coin disappears";
  145. cout << "\n";
  146. }
  147.  
  148. system("cls");
  149.  
  150.  
  151. cout << "You move on and you see another door" << endl;
  152. cout << name << " approaches door number 5..";
  153. cout << "\n What country has the highest population?";
  154. cin >> question1;
  155.  
  156. if (question1 == "China")
  157. {
  158. cout << "You hear a click and the door opens and you grab a coin...";
  159. cout << "\n";
  160. coins++;
  161. Sleep(2500);
  162. }
  163. else if (question1 != "China")
  164. {
  165. cout << "You triggered the trap and the coin disappears";
  166. cout << "\n";
  167. }
  168.  
  169. system("cls");
  170.  
  171. cout << "You move on and you see another door" << endl;
  172. cout << name << " approaches door number 6..";
  173. cout << "\n What is the capital city of Egypt?";
  174. cin >> question1;
  175.  
  176. if (question1 == "Cairo")
  177. {
  178. cout << "You hear a click and the door opens and you grab a coin...";
  179. cout << "\n";
  180. coins++;
  181. Sleep(2500);
  182. }
  183. else if (question1 != "Cairo")
  184. {
  185. cout << "You triggered the trap and the coin disappears";
  186. cout << "\n";
  187. }
  188.  
  189. system("cls");
  190.  
  191. cout << "You see the treasure there in all its glory, you snatch it and escape.";
  192. cout << "\n\n Congratulations! you won the game here are your statistics:";
  193. cout << "\n\nYour name: " << name;
  194. cout << "\nCoins collected: " << coins;
  195. cout << "\n\nType exit to go back to the menu";
  196. cin >> question1;
  197.  
  198. system("cls");
  199. break;
  200.  
  201.  
  202. case '2': system("cls");
  203. cout << "Instructions:";
  204. cout << "\n";
  205. cout << "Solve the 6 puzzles and collect as many coins as you can and the final treasure in the center of the tomb.";
  206. cout << "\n";
  207. break;
  208. }
  209.  
  210. case '3': cout << "Exiting program please wait.";
  211. Sleep(3500);
  212. break;
  213.  
  214.  
  215.  
  216. }
  217. } while (choice != '3');
  218.  
  219.  
  220.  
  221.  
  222.  
  223. system("PAUSE");
  224. return 0;
  225.  
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement