fork download
  1. #include <iostream>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <cmath>
  5. #include <conio.h>
  6. #include <fstream>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. char name[100];
  13. char dec;
  14. char cont;
  15. int code = 0;
  16. int codeCounter = 0;
  17. int num;
  18. cout << " Enter agent name: " << endl;
  19.  
  20. std::cin.getline(name, 100);
  21. cout << "Welcome agent " << name << " you have been chosen to fulfill a very important mission." << endl;
  22. cout << "Do you accept the mission?" << endl;
  23. cout << "Good. Let's begin. Press any character to continue " << endl;
  24. _getch();
  25. cout << "Okay first you should know that the address is 1337 E. Yanky Drive"
  26. << " Now the first decision of the mission is whether to enter from the front or back"
  27. << " Type F for front or B for back";
  28.  
  29. std::cin >> dec;
  30.  
  31. switch (dec)
  32. {
  33. case 'f':
  34. {
  35. srand(time(NULL));
  36. num = rand() % 1000 + 1;
  37. cout << num << endl;
  38.  
  39. if (num % 2 == 0)
  40. {
  41. cout << "You triggered the alarm" << endl;
  42.  
  43. while (code != 7331)
  44. {
  45. cout << "Enter the code to disable it: "
  46. << " \n *HINT* Code involves the address. " << endl;
  47. cin >> code;
  48. codeCounter++;
  49. //After 3 tries user is given another hint.
  50. if (codeCounter == 3)
  51. {
  52. cout << "Hint: Reverse address" << endl;
  53. }
  54. }
  55. }
  56. else
  57. {
  58. cout << "You made it in safely. " << endl;
  59. }
  60. }
  61. break;
  62.  
  63. case 'b':
  64. {
  65. cout << " Good!! You have successfully breached in the back" << endl;
  66. }
  67.  
  68. case 'F':
  69. {
  70. num = rand() % 1000 + 1;
  71.  
  72. if (num % 2 == 0)
  73. {
  74. cout << "You triggered the alarm" << endl;
  75. while (code != 7331)
  76. {
  77. cout << "Enter the code to disable it: "
  78. << " \n *HINT* Code involves the address. " << endl;
  79. cin >> code;
  80. codeCounter++;
  81. //After 3 tries user is given another hint.
  82. if (codeCounter == 3)
  83. {
  84. cout << "Hint: Reverse address" << endl;
  85. }
  86. }
  87. }
  88. else
  89. {
  90. cout << "You made it in safely. " << endl;
  91. }
  92. }
  93. break;
  94.  
  95. case 'B':
  96. {
  97. cout << "Good. You have successfully breached in the back. " << endl;
  98. }
  99. break;
  100.  
  101. default:
  102. {
  103. cout << "F or B..." << endl;
  104. }
  105. break;
  106. }
  107.  
  108. do{
  109. cout << "Now that you're in the house " << endl;
  110. cout << "Where do you want to look first (Enter corresponding letter) "
  111. << " \n Kitchen (K) "
  112. << " \n Living room (L) "
  113. << " \n Basement (B) "
  114. << " \n Upstairs Bedroom (U) "
  115. << " \n Master Bedroom (M) "
  116. << " \n Bathroom (N) "
  117. << " \n Attic (A) "
  118. << endl;
  119.  
  120. // Kitchen we want a note leading the player to the basement to find more clues (randomize the note).
  121. // Living room we want the black box with the information of the terrorists.
  122. // Items: Crow bar, key, blue prints of the inside of the house, axe, screw driver, pen and paper from the note.
  123. // We want the items to be randomized in these locations and when the player types in " Living Room" he is then printed.....
  124. // .....
  125.  
  126.  
  127. char y_nTen;
  128. char y_nNine;
  129. char y_nEight;
  130. char y_nSeven;
  131. char y_nSix;
  132. char y_nFive;
  133. char y_nFour;
  134. char y_nThree;
  135. char y_nTwo;
  136. char y_nOne;
  137. char look;
  138. int screwdrive = 0;
  139. int crowbar = 0;
  140. int key = 0;
  141. int items = 0;
  142. int blueprint = 0;
  143. int letter = 0;
  144. int axe = 0;
  145. int p_p = 0;
  146. cin >> look;
  147.  
  148. if (look == 'K' || look == 'K')
  149. {
  150. cout << "You notice a screwdriver on the counter. Do you pick it up? "
  151. << "\t Y/N" << endl;
  152. cin >> y_nOne;
  153.  
  154. if (y_nOne == 'Y' || y_nOne == 'y')
  155. {
  156. if (items < 3)
  157. {
  158. items++;
  159. screwdrive++;
  160. cout << "You now have a screwdriver." << endl;
  161. }
  162. else if (items >= 3){
  163. cout << "You already have three items. You can only have three." << endl;
  164.  
  165. }
  166. }
  167. }
  168.  
  169. if (look == 'L' || look == 'l')
  170. {
  171. cout << "You walk through the living room and notice there is a loose floor board. Do you examine it?"
  172. << "\t Y/N" << endl;
  173.  
  174. cin >> y_nTwo;
  175.  
  176. if (y_nTwo == 'Y')
  177. {
  178. if (screwdrive == 1)
  179. {
  180. cout << "You use the screwdriver to pry it open. There is a box underneath. Do you want to open it?"
  181. << "\t Y/N" << endl;
  182.  
  183. cin >> y_nThree;
  184.  
  185. if (y_nThree == 'Y' || y_nThree == 'y')
  186. {
  187. if (key == 1)
  188. {
  189. cout << "Congratulation! You found the terrorists plans and saved the world!" << endl;
  190. }
  191. else
  192. {
  193. cout << "The box is locked...you probably should've taken that key when you had the chance..." << endl;
  194. }
  195. }
  196. }
  197. else if (crowbar == 1)
  198. {
  199. cout << "You use the crowbar to pry it open. There is a box underneath. Do you want to open it?"
  200. << "\t Y/N" << endl;
  201. cin >> y_nThree;
  202. if (y_nThree == 'Y' || y_nThree == 'y')
  203. {
  204. if (key == 1)
  205. {
  206. cout << "Congratulation! You found the terrorists plans and saved the world!" << endl;
  207. }
  208. else
  209. {
  210. cout << "The box is locked...you probably should've taken that key when you had the chance..." << endl;
  211. }
  212. }
  213. }
  214. else
  215. {
  216. cout << "It's stuck...you need some tools to open it. Perhaps a screwdriver or crowbar?" << endl;
  217.  
  218. }
  219. }
  220. }
  221.  
  222. if (look == 'b' || look == 'B')
  223. {
  224. cout << "As you examine the kitchen you notice a loose brick in the wall. After checking it out there is a key behind the brick. "
  225. << "Do you want to pick it up?"
  226. << "\n Y/N?" << endl;
  227. cin >> y_nFour;
  228. if (y_nFour == 'y' || y_nFour == 'Y')
  229. {
  230. if (items < 3)
  231. {
  232. items++;
  233. key++;
  234. cout << "You have a key now." << endl;
  235. }
  236. else if (items >= 3)
  237. {
  238. cout << "You already have 3 items. You can only carry three." << endl;
  239.  
  240. }
  241. if (y_nFour == 'N' || y_nFour == 'n')
  242. {
  243. cout << "Suit yourself. " << endl;
  244. }
  245. }
  246. }
  247.  
  248. cout << "While looking through the basement you find a crowbar. Do you want to keep the crow bar?"
  249. << "\n Y/N" << endl;
  250. cin >> y_nFive;
  251.  
  252. if (y_nFive == 'Y' || y_nFive == 'y')
  253. {
  254. if (items < 3)
  255. {
  256. items++;
  257. crowbar++;
  258. cout << "You now have a crowbar." << endl;
  259. }
  260. else if (items >= 3)
  261. {
  262. cout << "You already have three items. You can only carry three." << endl;
  263. }
  264. }
  265.  
  266. if (y_nFive == 'n' || y_nFive == 'N')
  267. {
  268. cout << "Suit yourself." << endl;
  269. }
  270.  
  271. if (look == 'U' || look == 'u')
  272. {
  273. cout << "While looking through the upstairs bedroom you find some an axe. Do you want to keep the axe?"
  274. << "\n Y/N" << endl;
  275. cin >> y_nFive;
  276. if (y_nFive == 'Y' || y_nFive == 'y')
  277. {
  278. if (items < 3)
  279. {
  280. items++;
  281. axe++;
  282. cout << "You now have an axe." << endl;
  283.  
  284.  
  285. }
  286. else if (items >= 3){
  287. cout << "You already have three items. You can only carry three." << endl;
  288.  
  289. }
  290. }
  291. if (y_nFive == 'n' || y_nFive == 'N'){
  292. cout << "Suit yourself." << endl;
  293. }
  294. }
  295.  
  296. if (look == 'M' || look == 'm')
  297. {
  298. cout << "While looking through the master bedroom you find a letter addressed to no one in particular. Do you want to keep the letter?"
  299. << "\n Y/N" << endl;
  300. cin >> y_nFive;
  301. if (y_nFive == 'Y' || y_nFive == 'y')
  302. {
  303. if (items < 3)
  304. {
  305. items++;
  306. letter++;
  307. cout << "You now have a letter." << endl;
  308.  
  309.  
  310. }
  311. else if (items >= 3){
  312. cout << "You already have three items. You can only carry three." << endl;
  313. }
  314. }
  315. if (y_nFive == 'n' || y_nFive == 'N')
  316. {
  317. cout << "Suit yourself." << endl;
  318. }
  319. }
  320. if (look == 'N' || look == 'n')
  321. {
  322. cout << "While looking through the bathroom you find a pen and paper . Do you want to take the pen and paper with you? (Only counts as one item)"
  323. << "\n Y/N" << endl;
  324. cin >> y_nFive;
  325. if (y_nFive == 'Y' || y_nFive == 'y')
  326. {
  327. if (items < 3)
  328. {
  329. items++;
  330. p_p++;
  331. cout << "You now have blue prints." << endl;
  332. }
  333. else if (items >= 3){
  334. cout << "You already have three items. You can only carry three." << endl;
  335. }
  336. }
  337. if (y_nFive == 'n' || y_nFive == 'N'){
  338. cout << "Suit yourself." << endl;
  339. }
  340. }
  341. if (look == 'a' || look == 'A')
  342. {
  343. cout << "While looking through the attic you find some blueprints. Do you want to keep these blue prints?"
  344. << "\n Y/N" << endl;
  345. cin >> y_nFive;
  346. if (y_nFive == 'Y' || y_nFive == 'y')
  347. {
  348. if (items < 3)
  349. {
  350. items++;
  351. blueprint++;
  352. cout << "You now have blue prints." << endl;
  353.  
  354.  
  355. }
  356. else if (items >= 3)
  357. {
  358. cout << "You already have three items. You can only carry three." << endl;
  359. }
  360. }
  361. if (y_nFive == 'n' || y_nFive == 'N'){
  362. cout << "Suit yourself." << endl;
  363. }
  364.  
  365. }
  366.  
  367. } while (true);
  368.  
  369. return 0;
  370. }
  371.  
  372.  
  373.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
stdout
Standard output is empty