Advertisement
MDell95

mastermindtxt

Jul 14th, 2011
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.80 KB | None | 0 0
  1. //mastermind
  2.  
  3. /*before you start the game you have to create the txt-files highscores3.txt, highscores4.txt,
  4. highscores5.txt, highscores3bs.txt, highscores4bs.txt and highscores5bs.txt to store your
  5. highscores. in this files enter a high value (like
  6. 100 or 1000) in order to recognize your first score)
  7. otherwise download the full game at http://www.mediafire.com/?06ba2revh03q3ed */
  8.  
  9. #include <iostream>
  10. #include <cstdlib>
  11. #include <ctime>
  12. #include <fstream>
  13. #include <windows.h>
  14.  
  15. using namespace std;
  16.  
  17. int rep=4;
  18.  
  19. int afunction (int a, int v, int b, int c, int d, int e)
  20. {
  21. if (v==a)
  22. {
  23. cout << "1 ";
  24. }
  25. else if (v==b or v==c or v==d or v==e)
  26. {
  27. cout << "0 ";
  28. }
  29. else
  30. {
  31. cout << "- ";
  32. }
  33. }
  34.  
  35. int bfunction (int b, int w, int a, int c, int d, int e)
  36. {
  37. if (w==b)
  38. {
  39. cout << "1 ";
  40. }
  41. else if (w==a or w==c or w==d or w==e)
  42. {
  43. cout << "0 ";
  44. }
  45. else
  46. {
  47. cout << "- ";
  48. }
  49. }
  50.  
  51. int cfunction (int c, int x, int a, int b, int d, int e)
  52. {
  53. if (x==c)
  54. {
  55. cout << "1 ";
  56. }
  57. else if (x==a or x==b or x==d or x==e)
  58. {
  59. cout << "0 ";
  60. }
  61. else
  62. {
  63. cout << "- ";
  64. }
  65. }
  66.  
  67. int dfunction (int d, int y, int a, int b, int c, int e)
  68. {
  69. if (y==d)
  70. {
  71. cout << "1 ";
  72. }
  73. else if (y==a or y==b or y==c or y==e)
  74. {
  75. cout << "0 ";
  76. }
  77. else
  78. {
  79. cout << "- ";
  80. }
  81. }
  82.  
  83. int efunction (int e, int z, int a, int b, int c, int d)
  84. {
  85. if (z==e)
  86. {
  87. cout << "1 ";
  88. }
  89. else if (z==a or z==b or z==c or z==d)
  90. {
  91. cout << "0 ";
  92. }
  93. else
  94. {
  95. cout << "- ";
  96. }
  97. }
  98.  
  99. int newhighscore (int repeat)
  100. {
  101. do
  102. {
  103. cout << "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*" << endl;
  104. cout << "+* +*" << endl;
  105. cout << "+* CONGRATULATIONS!! +*" << endl;
  106. cout << "+* +*" << endl;
  107. cout << "+* NEW HIGHSCORE +*" << endl;
  108. cout << "+* +*" << endl;
  109. cout << "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*" << endl;
  110. Sleep(400);
  111. system("cls");
  112. Sleep(100);
  113. repeat-=1;
  114. }while (repeat>0);
  115. }
  116.  
  117. int dead (int repeat)
  118. {
  119. do
  120. {
  121. cout << " .---. X-X-X-X-X-X-X-X-X-X-X-X-X-X .---. " << endl;
  122. cout << " ( # # ) | THE BOMB DETONATED!!! | ( # # ) " << endl;
  123. cout << " | ^ | X X | ^ | " << endl;
  124. cout << " :+++: | YOU ARE DEAD | :+++: " << endl;
  125. cout << " `'´ X-X-X-X-X-X-X-X-X-X-X-X-X-X `'´ " << endl;
  126. Sleep(400);
  127. system("cls");
  128. Sleep(100);
  129. repeat-=1;
  130. }while (repeat>0);
  131. }
  132.  
  133. int highscores3 (int hs, int g)
  134. {
  135. if (g==1)
  136. {
  137. int us;
  138. string line;
  139. ifstream hscores3 ("highscores3.txt");
  140. getline (hscores3, line);
  141. cout << "Your actual highscore: " << line << endl;
  142. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  143. cin >> us;
  144.  
  145. if (us>hs)
  146. {
  147. system("cls");
  148. newhighscore (rep);
  149. ofstream hscores3;
  150. hscores3.open ("highscores3.txt");
  151. hscores3 << hs;
  152. hscores3.close();
  153. }
  154. }
  155. else if (g==2)
  156. {
  157. int us;
  158. string line;
  159. ifstream hscores3bs ("highscores3bs.txt");
  160. getline (hscores3bs, line);
  161. cout << "Your actual highscore: " << line << endl;
  162. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  163. cin >> us;
  164.  
  165. if (us>hs)
  166. {
  167. system("cls");
  168. newhighscore (rep);
  169. ofstream hscores3bs;
  170. hscores3bs.open ("highscores3bs.txt");
  171. hscores3bs << hs;
  172. hscores3bs.close();
  173. }
  174. }
  175. }
  176.  
  177. int highscores4 (int hs, int g)
  178. {
  179. if (g==1)
  180. {
  181. int us;
  182. string line;
  183. ifstream hscores4 ("highscores4.txt");
  184. getline (hscores4, line);
  185. cout << "Your actual highscore: " << line << endl;
  186. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  187. cin >> us;
  188.  
  189. if (us>hs)
  190. {
  191. system("cls");
  192. newhighscore (rep);
  193. ofstream hscores4;
  194. hscores4.open ("highscores4.txt");
  195. hscores4 << hs;
  196. hscores4.close();
  197. }
  198. }
  199. else if (g==2)
  200. {
  201. int us;
  202. string line;
  203. ifstream hscores4bs ("highscores4bs.txt");
  204. getline (hscores4bs, line);
  205. cout << "Your actual highscore: " << line << endl;
  206. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  207. cin >> us;
  208.  
  209. if (us>hs)
  210. {
  211. system("cls");
  212. newhighscore (rep);
  213. ofstream hscores4bs;
  214. hscores4bs.open ("highscores4bs.txt");
  215. hscores4bs << hs;
  216. hscores4bs.close();
  217. }
  218. }
  219. }
  220.  
  221. int highscores5 (int hs, int g)
  222. {
  223. if (g==1)
  224. {
  225. int us;
  226. string line;
  227. ifstream hscores5 ("highscores5.txt");
  228. getline (hscores5, line);
  229. cout << "Your actual highscore: " << line << endl;
  230. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  231. cin >> us;
  232.  
  233. if (us>hs)
  234. {
  235. system("cls");
  236. newhighscore (rep);
  237. ofstream hscores5;
  238. hscores5.open ("highscores5.txt");
  239. hscores5 << hs;
  240. hscores5.close();
  241. }
  242. }
  243. else if (g==2)
  244. {
  245. int us;
  246. string line;
  247. ifstream hscores5bs ("highscores5bs.txt");
  248. getline (hscores5bs, line);
  249. cout << "Your actual highscore: " << line << endl;
  250. cout << "\nPlease re-enter your highscore in order to compare it with your gained score: \n" << endl;
  251. cin >> us;
  252.  
  253. if (us>hs)
  254. {
  255. system("cls");
  256. newhighscore (rep);
  257. ofstream hscores5bs;
  258. hscores5bs.open ("highscores5bs.txt");
  259. hscores5bs << hs;
  260. hscores5bs.close();
  261. }
  262. }
  263. }
  264.  
  265. int achievement5 (int hs)
  266. {
  267. if (hs==1)
  268. {
  269. ofstream award5;
  270. award5.open ("award5.txt");
  271. award5 << "The cheater: crack the 5-spots-code with only one attempts";
  272. award5.close();
  273. }
  274. }
  275.  
  276. int achievement4 (int hs)
  277. {
  278. if (hs==1)
  279. {
  280. ofstream award4;
  281. award4.open ("award4.txt");
  282. award4 << "Hmmm...suspicious: crack the 4-spots-code with only one attempts";
  283. award4.close();
  284. }
  285. }
  286.  
  287. int achievement3 (int hs)
  288. {
  289. if (hs==1)
  290. {
  291. ofstream award3;
  292. award3.open ("award3.txt");
  293. award3 << "The lucky one: crack the 3-spots-code with only one attempts";
  294. award3.close();
  295. }
  296. }
  297.  
  298. int achievement5a (int hs)
  299. {
  300. if (hs>20)
  301. {
  302. ofstream award5a;
  303. award5a.open ("award5a.txt");
  304. award5a << "The unlucky: crack the 5-spots-code with more than 20 attempts";
  305. award5a.close();
  306. }
  307. }
  308.  
  309. int achievement4a (int hs)
  310. {
  311. if (hs>15)
  312. {
  313. ofstream award4a;
  314. award4a.open ("award4a.txt");
  315. award4a << "The looser: crack the 4-spots-code with more than 15 attempts";
  316. award4a.close();
  317. }
  318. }
  319.  
  320. int achievement3a (int hs)
  321. {
  322. if (hs>10)
  323. {
  324. ofstream award3a;
  325. award3a.open ("award3a.txt");
  326. award3a << "The stupid one: crack the 3-spots-code with more than 10 attempts";
  327. award3a.close();
  328. }
  329. }
  330.  
  331. int achievementcr (int j)
  332. {
  333. if (j==6)
  334. {
  335. ofstream awardcr;
  336. awardcr.open ("awardcr.txt");
  337. awardcr << "Check out the staff: view the credits";
  338. awardcr.close();
  339. }
  340. }
  341.  
  342. int achievementbs (int g)
  343. {
  344. if (g==2)
  345. {
  346. ofstream awardbs;
  347. awardbs.open ("awardbs.txt");
  348. awardbs << "The daredevil: play the bomb squad mode";
  349. awardbs.close();
  350. }
  351. }
  352.  
  353. int achievementdeath (int r)
  354. {
  355. if (r==0)
  356. {
  357. ofstream awarddeath;
  358. awarddeath.open ("awarddeath.txt");
  359. awarddeath << "Meeting with death: 'die' in the bomb squad mode";
  360. awarddeath.close();
  361. }
  362. }
  363.  
  364.  
  365.  
  366. int control (int a, int b, int c, int d, int e, int v, int w, int x, int y, int z, int l, int m, int n, int o, int p, int k)
  367. {
  368. srand (time(NULL));
  369. /////////////////////////////////////////////////////////////////
  370. l=rand() % 5;
  371. if (l==0)
  372. {
  373. afunction (a, v, b, c, d, e);
  374. }
  375. else if (l==1)
  376. {
  377. bfunction (b, w, a, c, d, e);
  378. }
  379. else if (l==2)
  380. {
  381. cfunction (c, x, a, b, d, e);
  382. }
  383. else if (k==3)
  384. {
  385. goto aaskip;
  386. }
  387. else if (l==3)
  388. {
  389. dfunction (d, y, a, b, c, e);
  390. }
  391. else if (k==4)
  392. {
  393. goto aaskip;
  394. }
  395. else if (l==4 and k==5)
  396. {
  397. efunction (e, z, a, b, c, d);
  398. }
  399. aaskip:
  400. ////////////////////////////////////////////////////////////////////
  401. do
  402. {
  403. m=rand() % 5;
  404. } while (m==l);
  405. if (m==0)
  406. {
  407. afunction (a, v, b, c, d, e);
  408. }
  409. else if (m==1)
  410. {
  411. bfunction (b, w, a, c, d, e);
  412. }
  413. else if (m==2)
  414. {
  415. cfunction (c, x, a, b, d, e);
  416. }
  417. else if (k==3)
  418. {
  419. goto abskip;
  420. }
  421. else if (m==3)
  422. {
  423. dfunction (d, y, a, b, c, e);
  424. }
  425. else if (k==4)
  426. {
  427. goto abskip;
  428. }
  429. else if (m==4 and k==5)
  430. {
  431. efunction (e, z, a, b, c, d);
  432. }
  433. abskip:
  434. //////////////////////////////////////////////////////////////////////////
  435. do
  436. {
  437. n=rand() % 5;
  438. } while (n==l or n==m);
  439. if (n==0)
  440. {
  441. afunction (a, v, b, c, d, e);
  442. }
  443. else if (n==1)
  444. {
  445. bfunction (b, w, a, c, d, e);
  446. }
  447. else if (n==2)
  448. {
  449. cfunction (c, x, a, b, d, e);
  450. }
  451. else if (k==3)
  452. {
  453. goto acskip;
  454. }
  455. else if (n==3)
  456. {
  457. dfunction (d, y, a, b, c, e);
  458. }
  459. else if (k==4)
  460. {
  461. goto acskip;
  462. }
  463. else if (n==4 and k==5)
  464. {
  465. efunction (e, z, a, b, c, d);
  466. }
  467. acskip:
  468. ///////////////////////////////////////////////////////////////////////////////
  469. do
  470. {
  471. o=rand() % 5;
  472. } while (o==l or o==m or o==n);
  473. if (o==0)
  474. {
  475. afunction (a, v, b, c, d, e);
  476. }
  477. else if (o==1)
  478. {
  479. bfunction (b, w, a, c, d, e);
  480. }
  481. else if (o==2)
  482. {
  483. cfunction (c, x, a, b, d, e);
  484. }
  485. else if (k==3)
  486. {
  487. goto adskip;
  488. }
  489. else if (o==3)
  490. {
  491. dfunction (d, y, a, b, c, e);
  492. }
  493. else if (k==4)
  494. {
  495. goto adskip;
  496. }
  497. else if (o==4 and k==5)
  498. {
  499. efunction (e, z, a, b, c, d);
  500. }
  501. adskip:
  502. /////////////////////////////////////////////////////////////////////////
  503. do
  504. {
  505. p=rand() % 5;
  506. } while (p==l or p==m or p==n or p==o);
  507. if (p==0)
  508. {
  509. afunction (a, v, b, c, d, e);
  510. }
  511. else if (p==1)
  512. {
  513. bfunction (b, w, a, c, d, e);
  514. }
  515. else if (p==2)
  516. {
  517. cfunction (c, x, a, b, d, e);
  518. }
  519. else if (k==3)
  520. {
  521. goto aeskip;
  522. }
  523. else if (p==3)
  524. {
  525. dfunction (d, y, a, b, c, e);
  526. }
  527. else if (k==4)
  528. {
  529. goto aeskip;
  530. }
  531. else if (p==4 and k==5)
  532. {
  533. efunction (e, z, a, b, c, d);
  534. }
  535. aeskip:
  536.  
  537. cout << endl;
  538. }
  539.  
  540. int classichs()
  541. {
  542. string line3;
  543. ifstream hscores3 ("highscores3.txt");
  544. getline (hscores3, line3);
  545. cout << "Your actual highscore for 3 spots: " << line3 << " attempts\n" << endl;
  546.  
  547. string line4;
  548. ifstream hscores4 ("highscores4.txt");
  549. getline (hscores4, line4);
  550. cout << "Your actual highscore for 4 spots: " << line4 << " attempts\n" << endl;
  551.  
  552. string line5;
  553. ifstream hscores5 ("highscores5.txt");
  554. getline (hscores5, line5);
  555. cout << "Your actual highscore for 5 spots: " << line5 << " attempts\n" << endl;
  556. }
  557.  
  558. int bombsquadhs()
  559. {
  560. string line3;
  561. ifstream hscores3bs ("highscores3bs.txt");
  562. getline (hscores3bs, line3);
  563. cout << "Your actual highscore for 3 spots: " << line3 << " attempts\n" << endl;
  564.  
  565. string line4;
  566. ifstream hscores4bs ("highscores4bs.txt");
  567. getline (hscores4bs, line4);
  568. cout << "Your actual highscore for 4 spots: " << line4 << " attempts\n" << endl;
  569.  
  570. string line5;
  571. ifstream hscores5bs ("highscores5bs.txt");
  572. getline (hscores5bs, line5);
  573. cout << "Your actual highscore for 5 spots: " << line5 << " attempts\n" << endl;
  574. }
  575.  
  576.  
  577. int main()
  578. {
  579.  
  580. int a, b, c, d, e, v, w, x, y, z, l, m, n, o, p, k, j, q, hscore, g, h;
  581.  
  582. menu:
  583.  
  584. cout << "MASTERMIND (powered by D-CODES) V 4.0" << endl;
  585. cout << "For questions, updates and new programs follow me on twitter: @d_codes_\n" << endl;
  586. cout << "Main menu: \n \n" << endl;
  587. cout << "Rules(1) \n" << endl;
  588. cout << "Controls(2) \n" << endl;
  589. cout << "Play(3) \n" << endl;
  590. cout << "Highscores(4) \n" << endl;
  591. cout << "Achievements(5) \n" << endl;
  592. cout << "Credits(6) \n" << endl;
  593. cout << "Exit(7) \n" << endl;
  594. cin >> j;
  595. achievementcr (j);
  596. cout << endl;
  597. if (j==1)
  598. {
  599. system("cls");
  600. cout << "Rules:\n" << endl;
  601. cout << "'a b c (d) (e)' is the code you have to crack, it consists in integer numbers" << endl;
  602. cout << "between 0 and 9. Every value appears max. one time. After the" << endl;
  603. cout << "confirmation of your code there will appear a series of '1', '0' and '-':" << endl;
  604. cout << "'1' means that one value of your code is at the right position." << endl;
  605. cout << "'0' means that one value is contained in the code but on the wrong position." << endl;
  606. cout << "'-' means that one value isn't contained in the code." << endl;
  607. cout << "ATTENTION: the '1', '0' and '-' are not in the right order!\n" << endl;
  608. cout << "Have fun! \n" << endl;
  609. cout << "Quit?" << endl;
  610. cin.get()=='\n';
  611. cin.get()=='\n';
  612. system("cls");
  613. goto menu;
  614. }
  615. else if (j==2)
  616. {
  617. system("cls");
  618. cout << "Divide your selected values by pressing 'Enter' or 'Space'" << endl;
  619. cout << "\nQuit?" << endl;
  620. cin.get()=='\n';
  621. cin.get()=='\n';
  622. system("cls");
  623. goto menu;
  624. }
  625. else if (j==3)
  626. {
  627. system("cls");
  628. cout << "Select game mode: \n" << endl;
  629. cout << "\nClassic(1)" << endl;
  630. cout << "\nBomb squad(2)" << endl;
  631. cin >> g;
  632. achievementbs (g);
  633.  
  634. if (g==1)
  635. {
  636.  
  637. wrong:
  638.  
  639. system("cls");
  640.  
  641. cout << "How many spots should the code have? ";
  642.  
  643. cin >> k;
  644.  
  645. if (k>5 || k<3)
  646. {
  647. cout << "You can just play with 3-5 spots!\n" << endl;
  648. cin.get()=='\n';
  649. cin.get()=='\n';
  650. goto wrong;
  651. }
  652.  
  653. srand (time(NULL));
  654. a=rand() % 10;
  655. do
  656. {
  657. b=rand() % 10;
  658. } while (b==a);
  659. do
  660. {
  661. c=rand() % 10;
  662. } while (c==a or c==b);
  663.  
  664. if (k==3)
  665. {
  666. goto askip;
  667. }
  668.  
  669. do
  670. {
  671. d=rand() % 10;
  672. } while (d==a or d==b or d==c);
  673.  
  674. if (k==4)
  675. {
  676. goto askip;
  677. }
  678.  
  679. do
  680. {
  681. e=rand() % 10;
  682. } while (e==a or e==b or e==c or e==d);
  683. cout << endl;
  684.  
  685. askip:
  686.  
  687. system("cls");
  688.  
  689. if (k==3)
  690. {
  691. cout << "a b c" << endl;
  692. //cout << a << b << c;
  693. }
  694. else if (k==4)
  695. {
  696. cout << "a b c d" << endl;
  697. //cout << a << b << c << d;
  698. }
  699. else if (k==5)
  700. {
  701. cout << "a b c d e" << endl;
  702. //cout << a << b << c << d << e;
  703. }
  704.  
  705. hscore=0;
  706.  
  707. aloop:
  708.  
  709. hscore++;;
  710.  
  711. cout << endl;
  712. cout << "Please enter the values (0-9):" << endl;
  713. cin >> v;
  714. cin >> w;
  715. cin >> x;
  716. if (k==3)
  717. {
  718. goto aovertake;
  719. }
  720. cin >> y;
  721. if (k==4)
  722. {
  723. goto aovertake;
  724. }
  725. cin >> z;
  726.  
  727. aovertake:
  728.  
  729. cin.get()=='\n';
  730.  
  731. cout << " Confirm(ENTER)? Quit(0)?";
  732.  
  733. if (cin.get()=='\n')
  734. {
  735. goto abuseless;
  736. }
  737. else
  738. {
  739. system("cls");
  740. goto menu;
  741. }
  742. abuseless:
  743.  
  744. if ((j==3 && (v==w or v==x or w==x)) || (j==4 && (v==w or v==x or v==y or w==x or w==y or x==y)) || (j==5 && (v==w or v==x or v==y or v==z or w==x or w==y or w==z or x==y or x==z or y==z)))
  745. {
  746. cout << "\nYou entered the same value for 2 or more spots!" << endl;
  747. goto aloop;
  748. }
  749.  
  750. //need some help: how to check if input is an int or not??? (Twitter: @MDell95)
  751.  
  752. control (a, b, c, d, e, v, w, x, y, z, l, m, n, o, p, k);
  753. }
  754. else if (g==2)
  755. {
  756. int att;
  757. srand (time(NULL));
  758. h=rand() % 3;
  759. if (h==0)
  760. {
  761. k=3;
  762. }
  763. else if (h==1)
  764. {
  765. k=4;
  766. }
  767. else if (h==2)
  768. {
  769. k=5;
  770. }
  771.  
  772. if (k==3)
  773. {
  774. while (att<7)
  775. {
  776. srand (time(NULL));
  777. att=rand() % 11;
  778. }
  779. }
  780. else if (k==4)
  781. {
  782. while (att<8)
  783. {
  784. srand (time(NULL));
  785. att=rand() % 16;
  786. }
  787. }
  788. else if (k==5)
  789. {
  790. while (att<9)
  791. {
  792. srand (time(NULL));
  793. att=rand() % 21;
  794. }
  795. }
  796.  
  797.  
  798. srand (time(NULL));
  799. a=rand() % 10;
  800. do
  801. {
  802. b=rand() % 10;
  803. } while (b==a);
  804. do
  805. {
  806. c=rand() % 10;
  807. } while (c==a or c==b);
  808.  
  809. if (k==3)
  810. {
  811. goto skip;
  812. }
  813.  
  814. do
  815. {
  816. d=rand() % 10;
  817. } while (d==a or d==b or d==c);
  818.  
  819. if (k==4)
  820. {
  821. goto skip;
  822. }
  823.  
  824. do
  825. {
  826. e=rand() % 10;
  827. } while (e==a or e==b or e==c or e==d);
  828. cout << endl;
  829.  
  830. skip:
  831.  
  832. system("cls");
  833.  
  834. if (k==3)
  835. {
  836. cout << "a b c" << endl;
  837. //cout << a << b << c;
  838. }
  839. else if (k==4)
  840. {
  841. cout << "a b c d" << endl;
  842. //cout << a << b << c << d;
  843. }
  844. else if (k==5)
  845. {
  846. cout << "a b c d e" << endl;
  847. //cout << a << b << c << d << e;
  848. }
  849.  
  850. hscore=0;
  851.  
  852. loop:
  853.  
  854. hscore++;;
  855.  
  856. cout << endl;
  857. cout << "You have " << att << " more attempts... Please enter the values (0-9):" << endl;
  858. cin >> v;
  859. cin >> w;
  860. cin >> x;
  861. if (k==3)
  862. {
  863. goto overtake;
  864. }
  865. cin >> y;
  866. if (k==4)
  867. {
  868. goto overtake;
  869. }
  870. cin >> z;
  871.  
  872. overtake:
  873.  
  874. cin.get()=='\n';
  875.  
  876. cout << " Confirm(ENTER)? Quit(0)?";
  877.  
  878. if (cin.get()=='\n')
  879. {
  880. goto buseless;
  881. }
  882. else
  883. {
  884. system("cls");
  885. goto menu;
  886. }
  887. buseless:
  888.  
  889. if ((j==3 && (v==w or v==x or w==x)) || (j==4 && (v==w or v==x or v==y or w==x or w==y or x==y)) || (j==5 && (v==w or v==x or v==y or v==z or w==x or w==y or w==z or x==y or x==z or y==z)))
  890. {
  891. cout << "\nYou entered the same value for 2 or more spots!" << endl;
  892. goto loop;
  893. }
  894.  
  895. //need some help: how to check if input is an int or not??? (Twitter: @MDell95)
  896. control (a, b, c, d, e, v, w, x, y, z, l, m, n, o, p, k);
  897.  
  898. att-=1;
  899.  
  900. if (att==0)
  901. {
  902. achievementdeath (att);
  903. system("cls");
  904. dead (rep);
  905. system("cls");
  906. goto menu;
  907. }
  908. }
  909.  
  910.  
  911.  
  912. ///////////////////////////////////////////////////////////////////////////
  913. if (v==a and w==b and x==c and y==d and z==e and k==5)
  914. {
  915. cout << endl;
  916. cout << "You've cracked the code!!" << endl;
  917. cout << "Quit?" << endl;
  918. cin.get()=='\n';
  919. cin.get()=='\n';
  920. system("cls");
  921. highscores5 (hscore, g);
  922. achievement5 (hscore);
  923. achievement5a (hscore);
  924. system("cls");
  925. goto menu;;
  926. }
  927.  
  928. if (v==a and w==b and x==c and y==d and k==4)
  929. {
  930. cout << endl;
  931. cout << "You've cracked the code!!" << endl;
  932. cout << "Quit?" << endl;
  933. cin.get()=='\n';
  934. cin.get()=='\n';
  935. system("cls");
  936. highscores4 (hscore, g);
  937. achievement4 (hscore);
  938. achievement4a (hscore);
  939. system("cls");
  940. goto menu;
  941. }
  942.  
  943. if (v==a and w==b and x==c and k==3)
  944. {
  945. cout << endl;
  946. cout << "You've cracked the code!!" << endl;
  947. cout << "Quit?" << endl;
  948. cin.get()=='\n';
  949. cin.get()=='\n';
  950. system("cls");
  951. highscores3 (hscore, g);
  952. achievement3 (hscore);
  953. achievement3a (hscore);
  954. system("cls");
  955. goto menu;
  956. }
  957.  
  958. goto loop;
  959.  
  960. } // '}' of else if for play(3)
  961. else if (j==4)
  962. {
  963. system("cls");
  964.  
  965. cout << "\nHighscores (classic):\n" << endl;
  966.  
  967. classichs();
  968.  
  969. cout << "\nHighscores (bomb squad):\n" << endl;
  970.  
  971. bombsquadhs();
  972.  
  973. cout << "\nQuit?" << endl;
  974.  
  975. cin.get()=='\n';
  976. cin.get()=='\n';
  977. system("cls");
  978. goto menu;
  979. }
  980. else if (j==5)
  981. {
  982. system("cls");
  983. cout << endl;
  984.  
  985. string line5;
  986. ifstream aw5 ("award5.txt");
  987. getline (aw5, line5);
  988. if (aw5.is_open())
  989. {
  990. cout << line5 << endl << endl;
  991. }
  992. else
  993. {
  994. cout << "?????????" << endl << endl;
  995. }
  996.  
  997. string line5a;
  998. ifstream aw5a ("award5a.txt");
  999. getline (aw5a, line5a);
  1000. if (aw5a.is_open())
  1001. {
  1002. cout << line5a << endl << endl;
  1003. }
  1004. else
  1005. {
  1006. cout << "?????????" << endl << endl;
  1007. }
  1008.  
  1009. string line4;
  1010. ifstream aw4 ("award4.txt");
  1011. getline (aw4, line4);
  1012. if (aw4.is_open())
  1013. {
  1014. cout << line4 << endl << endl;
  1015. }
  1016. else
  1017. {
  1018. cout << "?????????" << endl << endl;
  1019. }
  1020.  
  1021. string line4a;
  1022. ifstream aw4a ("award4a.txt");
  1023. getline (aw4a, line4a);
  1024. if (aw4a.is_open())
  1025. {
  1026. cout << line4a << endl << endl;
  1027. }
  1028. else
  1029. {
  1030. cout << "?????????" << endl << endl;
  1031. }
  1032.  
  1033. string line3;
  1034. ifstream aw3 ("award3.txt");
  1035. getline (aw3, line3);
  1036. if (aw3.is_open())
  1037. {
  1038. cout << line3 << endl << endl;
  1039. }
  1040. else
  1041. {
  1042. cout << "?????????" << endl << endl;
  1043. }
  1044.  
  1045. string line3a;
  1046. ifstream aw3a ("award3a.txt");
  1047. getline (aw3a, line3a);
  1048. if (aw3a.is_open())
  1049. {
  1050. cout << line3a << endl << endl;
  1051. }
  1052. else
  1053. {
  1054. cout << "?????????" << endl << endl;
  1055. }
  1056.  
  1057. string linecr;
  1058. ifstream awcr ("awardcr.txt");
  1059. getline (awcr, linecr);
  1060. if (awcr.is_open())
  1061. {
  1062. cout << linecr << endl << endl;
  1063. }
  1064. else
  1065. {
  1066. cout << "?????????" << endl << endl;
  1067. }
  1068.  
  1069. string linebs;
  1070. ifstream awbs ("awardbs.txt");
  1071. getline (awbs, linebs);
  1072. if (awbs.is_open())
  1073. {
  1074. cout << linebs << endl << endl;
  1075. }
  1076. else
  1077. {
  1078. cout << "?????????" << endl << endl;
  1079. }
  1080.  
  1081. string linede;
  1082. ifstream awde ("awarddeath.txt");
  1083. getline (awde, linede);
  1084. if (awde.is_open())
  1085. {
  1086. cout << linede << endl << endl;
  1087. }
  1088. else
  1089. {
  1090. cout << "?????????" << endl << endl;
  1091. }
  1092.  
  1093. if (aw5.is_open() && aw5a.is_open() && aw4.is_open() && aw4a.is_open() && aw3.is_open() && aw3a.is_open() && awcr.is_open() && awbs.is_open() && awde.is_open())
  1094. {
  1095. ofstream awardcoll;
  1096. awardcoll.open ("awardcoll.txt");
  1097. awardcoll << "The collector: get all achievements";
  1098. awardcoll.close();
  1099. }
  1100. string linecoll;
  1101. ifstream awcoll ("awardcoll.txt");
  1102. getline (awcoll, linecoll);
  1103. if (awcoll.is_open())
  1104. {
  1105. cout << linecoll << endl << endl;
  1106. }
  1107. else
  1108. {
  1109. cout << "?????????" << endl << endl;
  1110. }
  1111.  
  1112.  
  1113. cout << "\nQuit?" << endl;
  1114.  
  1115. cin.get()=='\n';
  1116. cin.get()=='\n';
  1117. system("cls");
  1118. goto menu;
  1119. }
  1120. else if (j==6)
  1121. {
  1122. system("cls");
  1123. cout << "\n DELL'software" << endl;
  1124. cout << "\n directed by" << endl;
  1125. cout << " Manuel Dell" << endl;
  1126. cout << "\n engineering" << endl;
  1127. cout << " Manuel Dell" << endl;
  1128. cout << "\n written by" << endl;
  1129. cout << " Manuel Dell" << endl;
  1130. cout << "\n producer" << endl;
  1131. cout << " Manuel Dell" << endl;
  1132. cout << "\n office manager" << endl;
  1133. cout << " Manuel Dell" << endl;
  1134. cout << "\n director of marketing" << endl;
  1135. cout << " Manuel Dell" << endl;
  1136. cout << "\n IT manager" << endl;
  1137. cout << " Manuel Dell" << endl;
  1138. cout << "\n systemadimistrator" << endl;
  1139. cout << " Manuel Dell" << endl;
  1140. cout << "\n information system analyst" << endl;
  1141. cout << " Manuel Dell" << endl;
  1142. cout << "\n design leads" << endl;
  1143. cout << " Manuel Dell" << endl;
  1144. cout << "\n game testers" << endl;
  1145. cout << " Manuel Dell" << endl;
  1146. cout << "\n special thanks" << endl;
  1147. cout << " codeblock.org" << endl;
  1148. cout << " cplusplus.com" << endl;
  1149. cout << " twitter.com" << endl;
  1150. cout << " pastebin.com" << endl;
  1151. cout << " mediafire.com\n" << endl;
  1152. cout << endl << "Quit?" << endl;
  1153. cin.get()=='\n';
  1154. cin.get()=='\n';
  1155. system("cls");
  1156. goto menu;
  1157. }
  1158. else if (j==7)
  1159. {
  1160. return 0;
  1161. }
  1162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement