cout << "Do you have weapons and armor?: ";
cin >> yEquip;
if (yEquip == 'y')
{
cout << endl;
string invintory2[6] =
{ {"Gold Armor"},
{"Gold Shield"},
{"Gold Helemt"},
{"Gold Boots"},
{"Gold Guantlets"},
{"Gold Sword"}, };
cout << "This is your invintory:" << endl;
for (int s = 0; s < 7; ++s)
{
cout << invintory2[s] << endl;
cout << "Stat boosts: "<<endl;
cout << "HP + 235 for full Gold" << endl;
yhp + 235;
cout << "P.Def + 310 for full Gold" << endl;
ypdef + 310;
cout << "P.Atk + 120 for Gold Sword" << endl;
ypatk + 120;
}
}
the program outputs this:
This is your invintory:
Gold Sword
Stat boosts:
HP + 235 for full Gold
P.Def + 310 for full Gold
P.Atk + 120 for Gold Sword
This is your invintory:
/ \251Ę\210 \204\342\277
but isn't it better to use an array over a vector?
That's an unusual opinion. I would say that the added functionality of a vector makes up for the slightly larger footprint it takes up in memory. So, I'd say use vectors where you can.
I would say that the added functionality of a vector makes up for the slightly larger footprint it takes up in memory. So, I'd say use vectors where you can.
im not really sure what you mean, as i havn't really tried working with vectors before.
what does a vector have that an array dosn't aside from iterating... which i suppose arrays have kind of...
To answer your earlier question about vectors, not having to know the size of your array ahead of time and managing the for loops by setting the condition to: for(unsigned i = 0; i < YourVector.size(); ++i)//... is usually enough reason to use them alone. Otherwise check this out: http://www.cplusplus.com/reference/vector/vector/