Guest User

Untitled

a guest
Sep 18th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include "Pokedex.h"
  5. #include "Pokemon.h"
  6.  
  7. int menu(void) {
  8. int opt;
  9.  
  10. printf("Escolha a opcao\n");
  11. printf("0. Sair\n");
  12. printf("1. Pokemon Capturado\n");
  13. printf("2. Exibir Pokedex\n");
  14. printf("3. Exibir Bolsa Pokemon\n");
  15. printf("4. Saber as informacoes de um pokemon\n");
  16. //printf("5. ")
  17. printf("Opcao: "); scanf("%d", &opt);
  18. return opt;
  19. }
  20.  
  21. int main () {
  22. tPokedex Px;
  23. tPokeBag Pb;
  24. int num, opt;
  25. if (initPokedex(&Px) == false) { //iniciando a Pokedex
  26. printf("Nao foi possivel cria a Pokedex\n");
  27. exit(0);
  28. }
  29. initBag(&Pb);
  30. do {
  31. opt = menu();
  32. switch(opt) {
  33. case 1:
  34. printf("Insiria o ID do Pokemon\n");
  35. scanf("%d", &num);
  36. system("clear");
  37. inserirPokemon(&Px, num);
  38. insereOrdenadoBag(&Pb, num);
  39. printf("----------------------------------------------------------");
  40. printf("\n\n");
  41. break;
  42. case 2:
  43. system("clear");
  44. imprimirPokedex(Px);
  45. printf("\n\n");
  46. break;
  47. case 3:
  48. system("clear");
  49. imprimeBag(Pb);
  50. printf("\n\n");
  51. break;
  52. case 4:
  53. printf("Insiria o ID do Pokemon\n");
  54. scanf("%d", &num);
  55. system("clear");
  56. if (!buscaPokemon (Px, num))
  57. printf("Voce nao possui esse Pokemon!!\n");
  58. else
  59. InfoPokemon (Px, num);
  60. break;
  61. case 0:
  62. system("clear");
  63. limpaBag(&Pb);
  64. limparPokedex(&Px);
  65. printf("\n\n\n");
  66. break;
  67. }
  68.  
  69. }while(opt);
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment