Advertisement
sebasvp2005

Untitled

May 1st, 2024
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.37 KB | None | 0 0
  1. #include "pch.h"
  2. #include "iostream"
  3. #include "conio.h"
  4. #include "time.h"
  5. #include "string"
  6.  
  7. using namespace std;
  8. using namespace System;
  9.  
  10.  
  11. bool salir(char texto []);
  12.  
  13. void ventana()
  14. {
  15.  
  16. Console::SetWindowSize(149, 40);
  17.  
  18. }
  19.  
  20. void logo_UPC()
  21. {
  22.  
  23. Console::ForegroundColor = ConsoleColor::DarkRed;
  24.  
  25. Console::SetCursorPosition(25, 10); cout << " ## ";
  26. Console::SetCursorPosition(25, 11); cout << " ,###. ";
  27. Console::SetCursorPosition(25, 12); cout << " # #####* # ";
  28. Console::SetCursorPosition(25, 13); cout << " .#/ ####### /#. ";
  29. Console::SetCursorPosition(25, 14); cout << " ##* #########. *## " << char(186) << " ";
  30. Console::SetCursorPosition(25, 15); cout << " .### ########### ###. " << char(186) << " ";
  31. Console::SetCursorPosition(25, 16); cout << " ###( #############( (### " << char(186) << " ## ## ####### ###### ";
  32. Console::SetCursorPosition(25, 17); cout << "##### #############( ##### " << char(186) << " ## ## ### ### ######## ";
  33. Console::SetCursorPosition(25, 18); cout << "##### *############# ##### " << char(186) << " ## ## ### ## ### ## ";
  34. Console::SetCursorPosition(25, 19); cout << "###### ##########. ###### " << char(186) << " ## ## ### ### ## ";
  35. Console::SetCursorPosition(25, 20); cout << "####### ######## ####### " << char(186) << " ## ## ####### ## ";
  36. Console::SetCursorPosition(25, 21); cout << "(######## (##### ########( " << char(186) << " ### ### ### ### ## ";
  37. Console::SetCursorPosition(25, 22); cout << " ########### #### ########## " << char(186) << " ######## ### ######## ";
  38. Console::SetCursorPosition(25, 23); cout << " ############# (## ############# " << char(186) << " ###### ### ###### ";
  39. Console::SetCursorPosition(25, 24); cout << " /###########################################/ " << char(186) << " ";
  40. Console::SetCursorPosition(25, 25); cout << " (########################################( " << char(186) << " ";
  41. Console::SetCursorPosition(25, 26); cout << " #################################### ";
  42. Console::SetCursorPosition(25, 27); cout << " (############################( ";
  43. Console::SetCursorPosition(25, 28); cout << " /###############/ ";
  44. Console::SetCursorPosition(25, 29); cout << " *######* ";
  45.  
  46. system("pause>0");
  47.  
  48. //Console::ForegroundColor = ConsoleColor::White;
  49.  
  50. }
  51.  
  52. void pantalla_carga()
  53. {
  54. system("cls");
  55.  
  56. int barra;
  57.  
  58. Console::ForegroundColor = ConsoleColor::DarkGray;
  59.  
  60. Console::SetCursorPosition(32, 7); cout << " .-----------------. .-----------------. ";
  61. Console::SetCursorPosition(32, 8); cout << " | | | | ";
  62. Console::SetCursorPosition(32, 9); cout << " | | | * | ";
  63. Console::SetCursorPosition(32, 10); cout << " | | | | ";
  64. Console::SetCursorPosition(32, 11); cout << " | * | | | ";
  65. Console::SetCursorPosition(32, 12); cout << ".-----------------. | | | | .-----------------.";
  66. Console::SetCursorPosition(32, 13); cout << "| | | | | * | | |";
  67. Console::SetCursorPosition(32, 14); cout << "| * | | | | | | * * |";
  68. Console::SetCursorPosition(32, 15); cout << "| | '-----------------' '-----------------' | |";
  69. Console::SetCursorPosition(32, 16); cout << "| * | | |";
  70. Console::SetCursorPosition(32, 17); cout << "| | .-----------------. .-----------------. | |";
  71. Console::SetCursorPosition(32, 18); cout << "| * | | | | | | * * |";
  72. Console::SetCursorPosition(32, 19); cout << "| | | * * | | * * | | |";
  73. Console::SetCursorPosition(32, 20); cout << "'-----------------' | | | | '-----------------'";
  74. Console::SetCursorPosition(32, 21); cout << " | * | | * * | ";
  75. Console::SetCursorPosition(32, 22); cout << " | | | | ";
  76. Console::SetCursorPosition(32, 23); cout << " | * * | | * * | ";
  77. Console::SetCursorPosition(32, 24); cout << " | | | | ";
  78. Console::SetCursorPosition(32, 25); cout << " '-----------------' '-----------------' ";
  79.  
  80.  
  81. Console::SetCursorPosition(61, 29); printf(". . . C A R G A N D O . . .");
  82.  
  83. for (barra = 32; barra < 117; barra++)
  84. {
  85.  
  86. Console::SetCursorPosition(barra, 32); cout << char(177);
  87.  
  88. _sleep(13);
  89.  
  90. }
  91.  
  92. }
  93.  
  94. void creditos()
  95. {
  96.  
  97. system("cls");
  98.  
  99. Console::ForegroundColor = ConsoleColor::Yellow;
  100.  
  101. Console::SetCursorPosition(50, 15); cout << "--------------- C R E D I T O S -----------------";
  102. Console::SetCursorPosition(50, 17); cout << " - UPC CAMPUS SAN MIGUEL ";
  103. Console::SetCursorPosition(50, 18); cout << " - TRABAJO PARCIAL 2024 ";
  104. Console::SetCursorPosition(50, 19); cout << " - Programador: Gomez Romero, Adrian Rogers ";
  105. Console::SetCursorPosition(50, 20); cout << " - Curso: Introduccion a los Algoritmos ";
  106. Console::SetCursorPosition(50, 21); cout << " - Docente: Mendiolaza Cornejo, Edson Duilio ";
  107. Console::SetCursorPosition(50, 22); cout << " - Seccion: W1SE ";
  108. Console::SetCursorPosition(50, 24); cout << "-------------------------------------------------";
  109.  
  110. system("pause>0");
  111.  
  112. }
  113.  
  114. void reglas()
  115. {
  116.  
  117. system("cls");
  118.  
  119. Console::ForegroundColor = ConsoleColor::Yellow;
  120.  
  121. Console::SetCursorPosition(32, 16); cout << "------------------------------------ R E G L A S ------------------------------------";
  122. Console::SetCursorPosition(32, 18); cout << " - El jugador debe de lanzar los dados. ";
  123. Console::SetCursorPosition(32, 19); cout << " - Si al lanzar los dados obtiene un 4, 5, 6, 9, o un 10 puede seguir jugando. ";
  124. Console::SetCursorPosition(32, 20); cout << " - Si al lanzar los dados obtiene un 2, 3, o un 12 el jugador pierde la partida. ";
  125. Console::SetCursorPosition(32, 21); cout << " - El jugador gana la partida si obtiene un 7 o un 11. ";
  126. Console::SetCursorPosition(32, 23); cout << "-------------------------------------------------------------------------------------";
  127.  
  128. system("pause>0");
  129.  
  130. }
  131.  
  132.  
  133. char dadogif[][100] = {
  134. " # ",
  135. " ## ## ",
  136. " ## ## ",
  137. " ## ## ",
  138. " ## ## ",
  139. "# * #",
  140. " ## ## ",
  141. " ## ## ",
  142. " ## ## ",
  143. " ## ## ",
  144. " # "
  145. };
  146.  
  147. char dadogif2[][100] = {
  148. " # ",
  149. " #### # ",
  150. " #### # ",
  151. "# # ",
  152. " # # ",
  153. " # * # ",
  154. " # # ",
  155. " # # ",
  156. " # #### ",
  157. " # #### ",
  158. " # "
  159. };
  160. char dadogif3[][100] = {
  161. " ",
  162. " ",
  163. " ",
  164. " ",
  165. " ",
  166. " * ",
  167. " ",
  168. " ",
  169. " ",
  170. " ",
  171. " "
  172. };
  173.  
  174.  
  175.  
  176.  
  177. void animar() {
  178. for (int i = 0; i < 11; i++) {
  179. Console::SetCursorPosition(50, 4 + i);
  180. cout << dadogif[i];
  181. }
  182. _sleep(100);
  183. for (int i = 0; i < 11; i++) {
  184. Console::SetCursorPosition(50, 4 + i);
  185. cout << dadogif2[i];
  186. }
  187. }
  188.  
  189. void dados(int dado, int x, int y) {
  190. Console::SetCursorPosition(x, y);
  191. switch (dado) {
  192. case 1:
  193. cout << ".-----------------.";
  194. Console::SetCursorPosition(x, y + 1);
  195. cout << "| |";
  196. Console::SetCursorPosition(x, y + 2);
  197. cout << "| |";
  198. Console::SetCursorPosition(x, y + 3);
  199. cout << "| |";
  200. Console::SetCursorPosition(x, y + 4);
  201. cout << "| * |";
  202. Console::SetCursorPosition(x, y + 5);
  203. cout << "| |";
  204. Console::SetCursorPosition(x, y + 6);
  205. cout << "| |";
  206. Console::SetCursorPosition(x, y + 7);
  207. cout << "| |";
  208. Console::SetCursorPosition(x, y + 8);
  209. cout << "'-----------------'";
  210. break;
  211. case 2:
  212. cout << ".-----------------.";
  213. Console::SetCursorPosition(x, y + 1);
  214. cout << "| |";
  215. Console::SetCursorPosition(x, y + 2);
  216. cout << "| * |";
  217. Console::SetCursorPosition(x, y + 3);
  218. cout << "| |";
  219. Console::SetCursorPosition(x, y + 4);
  220. cout << "| |";
  221. Console::SetCursorPosition(x, y + 5);
  222. cout << "| |";
  223. Console::SetCursorPosition(x, y + 6);
  224. cout << "| * |";
  225. Console::SetCursorPosition(x, y + 7);
  226. cout << "| |";
  227. Console::SetCursorPosition(x, y + 8);
  228. cout << "'-----------------'";
  229. break;
  230. case 3:
  231. cout << ".-----------------.";
  232. Console::SetCursorPosition(x, y + 1);
  233. cout << "| |";
  234. Console::SetCursorPosition(x, y + 2);
  235. cout << "| * |";
  236. Console::SetCursorPosition(x, y + 3);
  237. cout << "| |";
  238. Console::SetCursorPosition(x, y + 4);
  239. cout << "| * |";
  240. Console::SetCursorPosition(x, y + 5);
  241. cout << "| |";
  242. Console::SetCursorPosition(x, y + 6);
  243. cout << "| * |";
  244. Console::SetCursorPosition(x, y + 7);
  245. cout << "| |";
  246. Console::SetCursorPosition(x, y + 8);
  247. cout << "'-----------------'";
  248. break;
  249. case 4:
  250. cout << ".-----------------.";
  251. Console::SetCursorPosition(x, y + 1);
  252. cout << "| |";
  253. Console::SetCursorPosition(x, y + 2);
  254. cout << "| * * |";
  255. Console::SetCursorPosition(x, y + 3);
  256. cout << "| |";
  257. Console::SetCursorPosition(x, y + 4);
  258. cout << "| |";
  259. Console::SetCursorPosition(x, y + 5);
  260. cout << "| |";
  261. Console::SetCursorPosition(x, y + 6);
  262. cout << "| * * |";
  263. Console::SetCursorPosition(x, y + 7);
  264. cout << "| |";
  265. Console::SetCursorPosition(x, y + 8);
  266. cout << "'-----------------'";
  267. break;
  268. case 5:
  269. cout << ".-----------------.";
  270. Console::SetCursorPosition(x, y + 1);
  271. cout << "| |";
  272. Console::SetCursorPosition(x, y + 2);
  273. cout << "| * * |";
  274. Console::SetCursorPosition(x, y + 3);
  275. cout << "| |";
  276. Console::SetCursorPosition(x, y + 4);
  277. cout << "| * |";
  278. Console::SetCursorPosition(x, y + 5);
  279. cout << "| |";
  280. Console::SetCursorPosition(x, y + 6);
  281. cout << "| * * |";
  282. Console::SetCursorPosition(x, y + 7);
  283. cout << "| |";
  284. Console::SetCursorPosition(x, y + 8);
  285. cout << "'-----------------'";
  286. break;
  287. case 6:
  288. cout << ".-----------------.";
  289. Console::SetCursorPosition(x, y + 1);
  290. cout << "| |";
  291. Console::SetCursorPosition(x, y + 2);
  292. cout << "| * * |";
  293. Console::SetCursorPosition(x, y + 3);
  294. cout << "| |";
  295. Console::SetCursorPosition(x, y + 4);
  296. cout << "| * * |";
  297. Console::SetCursorPosition(x, y + 5);
  298. cout << "| |";
  299. Console::SetCursorPosition(x, y + 6);
  300. cout << "| * * |";
  301. Console::SetCursorPosition(x, y + 7);
  302. cout << "| |";
  303. Console::SetCursorPosition(x, y + 8);
  304. cout << "'-----------------'";
  305. break;
  306. }
  307. }
  308.  
  309. void gana_partida(int resultadoganado)
  310. {
  311.  
  312. system("cls");
  313.  
  314. Console::ForegroundColor = ConsoleColor::DarkCyan;
  315.  
  316. Console::SetCursorPosition(11, 11); cout << "######## ######## ### ###### ###### ###### ###### #### ###### ######## ####### #####";
  317. Console::SetCursorPosition(11, 12); cout << "######## ######## ### ######## ######## ######## ####### ###### ####### ######## ####### #####";
  318. Console::SetCursorPosition(11, 13); cout << "### ### ### #### ### ## #### ## ### ### ### ## ### ### ### #####";
  319. Console::SetCursorPosition(11, 14); cout << "######## ######## ### #### ## #### ## ## ### ### ## ## ######## ###### ### ";
  320. Console::SetCursorPosition(11, 15); cout << "######## ######## ### #### ## #### ## ## ### ### ## ## ######## ###### # ";
  321. Console::SetCursorPosition(11, 16); cout << "### ### ### #### ### ## #### ## ### ######## ## ### ### ### ### ";
  322. Console::SetCursorPosition(11, 17); cout << "### ######## ######## ###### ######## ######## ####### ### ### ####### ######## ####### #####";
  323. Console::SetCursorPosition(11, 18); cout << "### ######## ######## ###### ###### ###### ###### ## ## ###### ######## ####### ### ";
  324.  
  325. Console::SetCursorPosition(11, 21); cout << " ## ## #### ####### ###### #### ## ## #### ###### ###### ";
  326. Console::SetCursorPosition(11, 22); cout << " ### ### ###### ####### ######## ###### ### ## ###### ####### ### ### ";
  327. Console::SetCursorPosition(11, 23); cout << " ### ### ### ### ### ### ### ### #### ## ### ### ## ### ### ### ";
  328. Console::SetCursorPosition(11, 24); cout << " ######## ### ### ###### ## ### ### ### ##### ## ### ### ## ## ## ## ";
  329. Console::SetCursorPosition(11, 25); cout << " ######## ### ### ###### ## ## ### ### ## ##### ### ### ## ## ## ## ";
  330. Console::SetCursorPosition(11, 26); cout << " ### ### ######## ### ### ### ######## ## #### ######## ## ### ### ### ";
  331. Console::SetCursorPosition(11, 27); cout << " ### ### ### ### ####### ######## ### ### ## ### ### ### ####### ######## ";
  332. Console::SetCursorPosition(11, 28); cout << " ## ## ## ## ####### ###### ## ## ## ## ## ## ###### ###### ";
  333.  
  334. Console::SetCursorPosition(58, 35); cout << "Ganaste porque salio un " << resultadoganado << ".";
  335.  
  336.  
  337. }
  338.  
  339. void pierde_partida(int resultadoperdido)
  340. {
  341.  
  342. system("cls");
  343.  
  344. Console::ForegroundColor = ConsoleColor::DarkMagenta;
  345.  
  346. Console::SetCursorPosition(14, 11); cout << " ###### ## ## ######## ### #### ####### ######## ###### ### ### #### #####";
  347. Console::SetCursorPosition(14, 12); cout << "######## ## ## ######## ### ###### ####### ######## ######## ######## ###### #####";
  348. Console::SetCursorPosition(14, 13); cout << "### ### ## ## ### ### ### ### ### # ## # #### ######## ### ### #####";
  349. Console::SetCursorPosition(14, 14); cout << "### ### ## ## ######## ### ### ### ###### ## #### ### ### ### ### ### ";
  350. Console::SetCursorPosition(14, 15); cout << "### ### ## ## ######## ### ### ### ###### ## #### ### ### ### ### # ";
  351. Console::SetCursorPosition(14, 16); cout << "######## ### ### ### ### ######## ### ## #### ### ### ######## ### ";
  352. Console::SetCursorPosition(14, 17); cout << " ###### ######## ######## ######## ### ### ####### ## ###### ### ### ### ### #####";
  353. Console::SetCursorPosition(14, 18); cout << " ##### ###### ######## ######## ## ## ####### ## ###### ## ## ## ## ### ";
  354.  
  355. Console::SetCursorPosition(14, 21); cout << " ## ## #### ####### ####### ######## ####### ###### ###### ###### ###### ";
  356. Console::SetCursorPosition(14, 22); cout << " ### ### ###### ####### ### ### ######## ### ### ####### ######## ####### ### ### ";
  357. Console::SetCursorPosition(14, 23); cout << " ### ### ### ### ### ### ## ### ### ## ## ### #### ## ### ### ### ";
  358. Console::SetCursorPosition(14, 24); cout << " ######## ### ### ###### ### ### ######## ### ### ## ## #### ## ## ## ## ";
  359. Console::SetCursorPosition(14, 25); cout << " ######## ### ### ###### ####### ######## ####### ## ## #### ## ## ## ## ";
  360. Console::SetCursorPosition(14, 26); cout << " ### ### ######## ### ### ### ### ### ## ### #### ## ### ### ### ";
  361. Console::SetCursorPosition(14, 27); cout << " ### ### ### ### ####### ### ######## ### ### ####### ###### ####### ######## ";
  362. Console::SetCursorPosition(14, 28); cout << " ## ## ## ## ####### ### ######## ### ### ###### ###### ###### ###### ";
  363.  
  364. Console::SetCursorPosition(58, 35); cout << "Perdiste porque salio un " << resultadoperdido << ".";
  365.  
  366.  
  367. }
  368.  
  369. void dibujar_bordes()
  370. {
  371.  
  372. system("cls");
  373.  
  374. Console::ForegroundColor = ConsoleColor::White;
  375.  
  376. Console::SetCursorPosition(1, 1);
  377.  
  378. for (int i = 1; i <= 147; i++)
  379. {
  380.  
  381. Console::SetCursorPosition(i, 1); cout << char(219);
  382. Console::SetCursorPosition(i, 38); cout << char(219);
  383.  
  384. }
  385. for (int j = 1; j <= 38; j++)
  386. {
  387. Console::SetCursorPosition(1, j); cout << char(219);
  388. Console::SetCursorPosition(147, j); cout << char(219);
  389.  
  390. }
  391.  
  392. }
  393.  
  394. void tirar_dados(int& dado1, int& dado2)
  395. {
  396. dado1 = rand() % 6 + 1;
  397. dado2 = rand() % 6 + 1;
  398. }
  399.  
  400. string verificar_resultado(int total)
  401. {
  402.  
  403. if (total == 7 || total == 11) {
  404. return "ganar";
  405. }
  406. else if (total == 2 || total == 3 || total == 12) {
  407. return "perder";
  408. }
  409. else {
  410. return "continuar";
  411. }
  412.  
  413. }
  414.  
  415. void juego()
  416. {
  417. int dado1, dado2;
  418. int suma;
  419. string resultado;
  420.  
  421. system("cls");
  422. dibujar_bordes();
  423.  
  424. Console::SetCursorPosition(3, 3); cout << "###### ### ### ###### #### ###### ##### ### ###### ### ##### ## ## ###### ##### ##### ";
  425. Console::SetCursorPosition(3, 4); cout << "###### ####### ### ### ###### ###### ####### ##### ###### ### ####### ### ### ###### ####### ### ###";
  426. Console::SetCursorPosition(3, 5); cout << "## ####### ### ## ### ## ### ### ### ## ### ### ### ### ## ### ### ###";
  427. Console::SetCursorPosition(3, 6); cout << "###### ## ## ### ### ### ###### ### ### ### ###### ### ## ## ### ###### ## ### ## ##";
  428. Console::SetCursorPosition(3, 7); cout << "##### ### ### ###### ### ##### ####### ### ### ##### ### ### ### ## ##### ## ## ## ##";
  429. Console::SetCursorPosition(3, 8); cout << "### ### ### ### ### ## ### ####### ## ### ### ## #### ### ### ### ### ### ### ###";
  430. Console::SetCursorPosition(3, 9); cout << "####### ## ## ### ##### ###### ####### ### ### ####### ####### ####### ####### ###### ####### #######";
  431. Console::SetCursorPosition(3, 10); cout << "##### ## ## ### ##### ##### ###### ## ## ##### ##### ##### ##### ###### ###### ##### ";
  432.  
  433. Console::SetCursorPosition(3, 14); cout << "Presiona cualquier tecla para lanzar los dados...";
  434. getch();
  435.  
  436. do
  437. {
  438. tirar_dados(dado1, dado2);
  439. suma = dado1 + dado2;
  440.  
  441. for (int i = 0; i < 3; i++) animar();
  442.  
  443. Console::SetCursorPosition(3, 17); cout << "Resultado del lanzamiento:";
  444. dados(dado1, 14, 20);
  445. dados(dado2, 54, 20);
  446. Console::SetCursorPosition(90, 17); cout << "Suma: " << suma << " ";
  447.  
  448. resultado = verificar_resultado(suma);
  449.  
  450. if (resultado == "ganar")
  451. {
  452. getch();
  453. gana_partida(suma);
  454. getch();
  455.  
  456. }
  457. else if (resultado == "perder")
  458. {
  459. getch();
  460. pierde_partida(suma);
  461. getch();
  462. }
  463. else {
  464. Console::SetCursorPosition(3, 32); cout << "Sigue jugando...";
  465. Console::SetCursorPosition(3, 34); cout << "Presiona cualquier tecla para lanzar de nuevo.";
  466. getch();
  467. }
  468.  
  469. } while (resultado == "continuar");
  470. }
  471.  
  472. void despedida()
  473. {
  474.  
  475. system("cls");
  476.  
  477. Console::ForegroundColor = ConsoleColor::DarkGreen;
  478.  
  479. Console::SetCursorPosition(18, 11); cout << " ###### ####### #### ###### ###### #### ####### ####### ###### ####### ";
  480. Console::SetCursorPosition(18, 12); cout << "######## ### ### ###### ######## ######## ###### ####### ### ### ### ### ### ###";
  481. Console::SetCursorPosition(18, 13); cout << "### ### ## ### ### ### ## #### ### ### ### ### ## ### ### ### ##";
  482. Console::SetCursorPosition(18, 14); cout << "## ### ### ### ### ### ## #### ### ### ###### ### ### ## ## ### ###";
  483. Console::SetCursorPosition(18, 15); cout << "## ## ####### ### ### ## #### ### ### ###### ####### ## ## ####### ";
  484. Console::SetCursorPosition(18, 16); cout << "### ### ### ### ######## ### ## #### ######## ### ### ### ### ### ###";
  485. Console::SetCursorPosition(18, 17); cout << "######## ### ### ### ### ######## ###### ### ### ####### ### ######## ### ###";
  486. Console::SetCursorPosition(18, 18); cout << " ###### ### ### ## ## ###### ###### ## ## ####### ### ###### ### ###";
  487.  
  488. Console::SetCursorPosition(18, 21); cout << " ######## ## ## ###### #### ####### ";
  489. Console::SetCursorPosition(18, 22); cout << " ######## ## ## ######## ###### ### ### ";
  490. Console::SetCursorPosition(18, 23); cout << " ### ## ## ### ### ### ### ## ";
  491. Console::SetCursorPosition(18, 24); cout << " ### ## ## ## ### ### ### ### ### ";
  492. Console::SetCursorPosition(18, 25); cout << " ### ## ## ## ## ### ### ####### ";
  493. Console::SetCursorPosition(18, 26); cout << " ## ### ### ### ### ### ######## ### ### ";
  494. Console::SetCursorPosition(18, 27); cout << " ######## ######## ######## ### ### ### ### ";
  495. Console::SetCursorPosition(18, 28); cout << " ###### ###### ###### ## ## ### ### ";
  496.  
  497.  
  498.  
  499. system("pause>0");
  500.  
  501. exit(0);
  502.  
  503. }
  504.  
  505. bool salir(char texto [])
  506. {
  507. char confirmar;
  508.  
  509. do
  510. {
  511. Console::SetCursorPosition(58, 35); cout << "¨Estas seguro de que deseas " << texto << "?";
  512. Console::SetCursorPosition(58, 37); cout << " [Y] SI [N] NO ";
  513. confirmar = _getch();
  514. switch (confirmar)
  515. {
  516. case 'y':
  517. return true;
  518. case 'n':
  519. return false;
  520. }
  521.  
  522. } while (1);
  523. }
  524.  
  525. void menu() {
  526.  
  527. int opcion = 0;
  528.  
  529. do
  530. {
  531. system("cls");
  532.  
  533. Console::ForegroundColor = ConsoleColor::DarkYellow;
  534.  
  535. Console::SetCursorPosition(48, 11); cout << " ###### ####### #### ####### ####### ";
  536. Console::SetCursorPosition(48, 12); cout << " ######## ### ### ###### ### ### ####### ";
  537. Console::SetCursorPosition(48, 13); cout << " ### ## ### ## ### ### ### ## #### ";
  538. Console::SetCursorPosition(48, 14); cout << " ### ## ### ## ### ### ### ## ### ";
  539. Console::SetCursorPosition(48, 15); cout << " ## ### ## ### ### ### ## #### ";
  540. Console::SetCursorPosition(48, 16); cout << " ## ### ## ### ### ### ## #### ";
  541. Console::SetCursorPosition(48, 17); cout << " ## ### ### ### ### ### ### #### ";
  542. Console::SetCursorPosition(48, 18); cout << " ## ####### ### ### ####### #### ";
  543. Console::SetCursorPosition(48, 19); cout << " ## ### ### ### ### ### #### ";
  544. Console::SetCursorPosition(48, 20); cout << " ### ## ### ### ######## ### ### ";
  545. Console::SetCursorPosition(48, 21); cout << " ### ## ### ### ### ### ### #### ";
  546. Console::SetCursorPosition(48, 22); cout << " ######## ### ### ### ### ### ####### ";
  547. Console::SetCursorPosition(48, 23); cout << " ###### ### ### ## ## ### ####### ";
  548.  
  549. Console::ForegroundColor = ConsoleColor::White;
  550.  
  551. Console::SetCursorPosition(48, 24); cout << "______________________________________________________";
  552. Console::SetCursorPosition(48, 26); cout << "------------------------------------------------------";
  553.  
  554. Console::ForegroundColor = ConsoleColor::Cyan;
  555.  
  556. Console::SetCursorPosition(49, 28); cout << "[1] JUGAR [2] REGLAS [3] CREDITOS [0] SALIR";
  557. char tecla = 45;
  558. do
  559. {
  560. if (_kbhit()) {
  561. tecla = _getch();
  562. switch (tecla)
  563. {
  564. case 49:
  565. opcion = 1;
  566. break;
  567. case 50:
  568. opcion = 2;
  569. break;
  570. case 51:
  571. opcion = 3;
  572. break;
  573. case 48:
  574. opcion = 0;
  575. break;
  576. }
  577. }
  578. } while (tecla < 48 || tecla > 51);
  579.  
  580. switch (opcion)
  581. {
  582. case 1:
  583. juego();
  584. break;
  585. case 2:
  586. reglas();
  587. break;
  588. case 3:
  589. creditos();
  590. break;
  591. case 0:
  592. if (salir("salir")) {
  593. despedida();
  594. exit(0);
  595. }
  596. break;
  597. default:
  598. break;
  599. }
  600.  
  601. } while (!(opcion == 1));
  602.  
  603. }
  604.  
  605. int main()
  606. {
  607.  
  608. srand(time(0));
  609.  
  610. Console::CursorVisible = false;
  611. ventana();
  612. logo_UPC();
  613. pantalla_carga();
  614. while (true)
  615. {
  616.  
  617. menu();
  618.  
  619. system("pause>0");
  620. }
  621.  
  622. return 0;
  623. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement