< Previous | Contents | Next >
Next I display the number of items the hero has in his possession.
cout << "You have " << inventory.size() << " items.\n";
I get the size of inventory by calling the size() member function with inventory.size(). The size() member function simply returns the size of a vector. In this case, it returns 3.