-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokemon.cpp
More file actions
62 lines (50 loc) · 866 Bytes
/
Copy pathPokemon.cpp
File metadata and controls
62 lines (50 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Definir el tipo abstracto de datos Pokemon como un numero entero
* que representa la vida y un nombre. Su interfaz es la siguiente:
*
* Implementar esta interfaz destructiva, utilizando memoria de Heap.
*/
#include "Pokemon.h"
struct PokemonSt {
int vida;
string nombre;
};
Pokemon crearPokemon(string nombre)
{
Pokemon p = new PokemonSt;
p->nombre = nombre;
p->vida = 10;
return p;
};
void restarVida(Pokemon& p)
{
p->vida = p->vida - 10;
};
void cambiarNombre(Pokemon& p, string nombre)
{
p->nombre = nombre;
};
bool estaVivo(Pokemon p)
{
return(p->vida>0);
};
string getNombre(Pokemon p)
{
return(p->nombre);
};
int getVida(Pokemon p)
{
return(p->vida);
};
/*
void luchar(Pokemon& p, Pokemon& r)
{
};
void lucharN(int n, Pokemon& p, Pokemon& r)
{
};
*/
void destruir(Pokemon& p)
{
delete p;
};