Advertisement
xickoh

main

Jan 7th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. /*
  8. * File: main.c
  9. * Author: francisco, juliana, pedro
  10. *
  11. * Created on 21 de Novembro de 2017, 9:17
  12. */
  13.  
  14. #ifdef _WIN32
  15. #include <conio.h>
  16. #else
  17. #include <stdio.h>
  18. #define clrscr() printf("\e[1;1H\e[2J")
  19. #endif
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <malloc.h>
  23. #include <time.h>
  24. #include <math.h>
  25. #include "LP_Leitura.h"
  26. #include "LP_Utils.h"
  27. #include "common.h"
  28. #include "cpu.h"
  29. #include "credits.h"
  30. #include "history.h"
  31. #include "human.h"
  32.  
  33.  
  34. void showMenu() {
  35. int option = 0;
  36. gamesHistory *game;
  37. int gamesNumber, maxSize;
  38.  
  39. while (option != 5) {
  40. clrscr(); //Clear the screen
  41. readInt(&option, 1, 5, "Introduza um número de 1 a 5\n"
  42. "1- Jogar contra o CPU\n"
  43. "2- Jogar localmente\n"
  44. "3- Ver histórico de jogos\n"
  45. "4- Créditos\n"
  46. "5- Sair\n");
  47.  
  48. if (option > 0 && option < 6) {
  49. switch (option) {
  50. case 1:
  51. setupPlayCPU();
  52. break;
  53. case 2:
  54. setupPlayHuman();
  55. break;
  56. case 3:
  57. readData(&game, &gamesNumber, &maxSize);
  58. listGamesHistory(game, gamesNumber);
  59. break;
  60. case 4:
  61. credits();
  62. break;
  63. case 5:
  64. exit(0);
  65. break;
  66. }
  67. }
  68. }
  69. }
  70.  
  71. int main(int argc, char** argv) {
  72.  
  73.  
  74. showMenu();
  75.  
  76.  
  77. return (EXIT_SUCCESS);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement