V

Dec 15, 2015 at 2:47am
Hi how are you doing
Last edited on Dec 16, 2015 at 12:20am
Dec 15, 2015 at 4:04am
What array?
Dec 15, 2015 at 9:26am
Instead of using the variable numItems to keep track of the size you can use use the size() member function.

 
inventory.size()

http://www.cplusplus.com/reference/vector/vector/size/
Last edited on Dec 15, 2015 at 9:27am
Dec 15, 2015 at 7:39pm
So just like this?
int reset =1;
do {

cin.ignore();
cout << " Your weapons are: \n";

for (int i = 0; i < inventory.size(); ++i)
{
cout << "\t" << inventory[i] << endl;
}
Dec 15, 2015 at 7:45pm
Yes, that looks like it should work.
Topic archived. No new replies allowed.