Hi all,
I have a class which contains a struct that holds some variables, string, int's.
Now, one of the variables (string) in the struct is used to compare it with a name, if the name is in the struct, it has to be returned from my function with it's own integer variables to be put into a separate list.
The thing is, how is the code written to do so ?
struct ArmorArray
{
std::string armorName;
int armorCheck;
int maxDext;
int price;
ArmorArray *nxtArmor;
};
class Armor
{
private:
ArmorArray ArmorList[13];
ArmorArray *p_List;
int m_SIZEARRAY;
std::string m_ArmorName;
std::string m_String;
public:
Armor();
~Armor() {}
p_List BuyArmor();
std::string CreateString(std::string &myString);
std::string ArmorBought(std::string &bought);
};
p_List Armor::BuyArmor()
{
m_ArmorName = CreateString (m_String);
for (int i = 0; i < m_SIZEARRAY; i++)
{
if(!m_ArmorName.compare(ArmorList[i].armorName))
{
return ArmorList[i];
}
}
//return m_ArmorName = "Armor does not exist ! Try again or return to previous menu !";
}
Thanks for any assistance.