Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include "Pokedex.h"
- #include "Pokemon.h"
- #define MAX 10
- bool initPokedex(tPokedex* p) {
- int i=0;
- p->v = (tPokedex*) malloc (MAX*sizeof(tPokedex));
- if (p == NULL)
- return false;
- else {
- p->tamMax = MAX;
- p->numElems = 0;
- for (i=0;i<MAX;i++) { //Iniciando a pokedex com nenhum pokemon registrado.
- p->v[i].reg = false;
- p->v[i].ID = i+1;
- }
- return true;
- }
- return false;
- }
- // ***********************************************
- // *** ***
- // ***********************************************
- void limparPokedex (tPokedex* p) {
- int i;
- for (i=0;i<MAX;i++) { //Iniciando a pokedex com nenhum pokemon registrado.
- p->v[i].reg = false;
- p->v[i].ID = i+1;
- }
- }
- // ***********************************************
- // *** ***
- // ***********************************************
- bool inserirPokemon(tPokedex* p, int id) {
- p->v[id-1].reg = true;
- p->numElems++;
- p->v[id-1].ID = id;
- printf("Pokemon %d inserido com sucesso\n", id);
- return true;
- }
- // ***********************************************
- // *** ***
- // ***********************************************
- bool buscarPokemon() {
- return false;
- }
- // ***********************************************
- // *** ***
- // ***********************************************
- void imprimirPokedex(tPokedex p) {
- int i=0;
- while (i<MAX) {
- if (p.v[i].reg == true)
- printf("Pokemon %d resgistrado\n", p.v[i].ID);
- else
- printf("Pokemon %d nao registrado\n", p.v[i].ID);
- i++;
- }
- }
- // ***********************************************
- // *** ***
- // ***********************************************
- int tamPokedex() {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment