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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
struct Move
{
string name;
int selfHPEffect;
int otherHPEffect;
int selfAtkEffect;
int otherAtkEffect;
int selfDefEffect;
int otherDefEffect;
};
struct Pokemon
{
string name;
string type;
int centimeterHeight;
int gramWeight;
int hp;
int attack;
int defense;
Move move1;
Move move2;
};
Move attackMove(string name, int damage)
{
return (name, 0, -damage, 0, 0, 0, 0);
}
Move healMove(string name, int hp)
{
return (name, hp, 0, 0, 0, 0, 0);
}
string shortDescription(Pokemon p)
{
return p.name + " (" + p.type + ")";
}
int main()
{
const int SIZE = 5;
Pokemon db[SIZE] = ( ( "Turtwig"
, "Grass"
, 41
, 10200
, 55
, 68
, 64
, attackMove("Rock Smash", 40)
, healMove("Heal", 80)
)
, ( "Turtwig"
, "Grass"
, 41
, 10200
, 55
, 68
, 64
, attackMove("Rock Smash", 40)
, healMove("Heal", 80)
)
, ( "Turtwig"
, "Grass"
, 41
, 10200
, 55
, 68
, 64
, attackMove("Rock Smash", 40)
, healMove("Heal", 80)
)
, ( "Turtwig"
, "Grass"
, 41
, 10200
, 55
, 68
, 64
, attackMove("Rock Smash", 40)
, healMove("Heal", 80)
)
, ( "Turtwig"
, "Grass"
, 41
, 10200
, 55
, 68
, 64
, attackMove("Rock Smash", 40)
, healMove("Heal", 80)
)
);
for(int i = 0; i < SIZE; ++i)
{
cout << shortDescription(db[i]) << endl;
}
}
|