#include <vector>
#include <string>
using namespace std;
struct Box
{
string name;
float height;
};
void insertBox(vector<Box> & boxes);
void deleteBox(vector<Box> & boxes);
void displayBoxes(vector<Box> & boxes);
void eraseAllBoxes(vector<Box> & boxes);
int main()
{
char answer = 'Y';
vector<Box> boxes;
char choice;
do {
cout << "A. add a box to the vector" << endl;
cout << "B. delete a box from the vector" << endl;
cout << "C. display the vector of boxes" << endl;
cout << "D. quit" << endl << endl;
cout << "Enter choice: ";
cin >> choice;
cin.ignore();
switch(toupper(choice))
{
case 'A': insertBox(boxes);
break;
case 'B': deleteBox(boxes);
break;
case 'C' : displayBoxes(boxes);
break;
case 'D' : eraseAllBoxes(boxes);
return 0;
default : cout << endl << endl << "Error!" << endl;
}
cout << "Enter another choice (Y or N)? ";
cin >> answer;
} while (toupper(answer) == 'Y');
}
void insertBox(vector<Box> & boxes)
{
char choice;
Box box;
cout << "Enter a name for a box: ";
getline(cin, box.name);
cout << "Enter the height of the box in inches: ";