Question: need help with podex.cpp and pokemon.cpp MY POKEMON.CPP #include pokemon.h #include / / Constructor for Pok mon with one type Pokemon::Pokemon ( string name,
need help with podex.cpp and pokemon.cpp
MY POKEMON.CPP
#include "pokemon.h
#include
Constructor for Pokmon with one type
Pokemon::Pokemonstring name, int ndex, Type type
: ndexndexnamename typecount
types type;
Constructor for Pokmon with two types
Pokemon::Pokemonstring name, int ndex, Type type Type type
: ndexndexnamename typecount
types type;
types type;
Constructor that initializes a Pokmon from a summary string
Pokemon::Pokemonstring summary
stringstream sssummary;
string tempname, tempndexstr temptype temptype;
getliness tempname, ;
name tempname;
getliness tempndexstr;
ndex stoitempndexstrsubstr; Remove the # and convert to int
getliness temptype;
types stringtotypetemptype;
if getliness temptype Check if there's a second type
types stringtotypetemptype;
typecount ;
else
typecount ;
Returns the name of the Pokmon
string Pokemon::name
return name;
Returns the Ndex number of the Pokmon
int Pokemon::Ndex
return ndex;
Returns the first type of the Pokmon
Pokemon::Type Pokemon::type
return types;
Checks if the Pokmon has two types
bool Pokemon::ismultitype
return typecount ;
Returns the second type of the Pokmon or the first type if it has only one type
Pokemon::Type Pokemon::type
return ismultitype types : types;
Calculates the damage multiplier for a given attack type
float Pokemon::damagemultiplierType attacktype
float multiplier ;
if attacktype Normal
return ;
else if attacktype Fighting
if type Normal type Normal
multiplier ;
if type Flying type Flying type Poison type Poison
multiplier ;
else if attacktype Flying
if type Fighting type Fighting
multiplier ;
else if attacktype Poison
if type Poison type Poison
multiplier ;
return multiplier;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
