50 cout<<
"Bag Driver - Tests the Bag class using two bags" << endl;
53 cout<<
"----------------------------------" << endl;
54 cout<<
"Would you like to restore a bag from a file? (Y/N) ";
57 getline(cin, restoreBagFlg);
58 if(restoreBagFlg[0] ==
'Y' || restoreBagFlg[0] ==
'y'){
67 cout <<
"\nEnter menu selection (0 for menu): ";
68 getline(cin, menuOption);
70 }
while(menuOption[0] !=
'9');
88 while(bagNum != 1 && bagNum != 2)
90 cout <<
"Which bag (1 or 2)? ";
104 vector<string> bagVector = bag.
toVector();
106 if(bagVector.size() > 0)
108 cout <<
"The bag contains: " << endl;
109 for(
unsigned int i=0; i<bagVector.size(); i++){
110 cout << bagVector[i] <<
", ";
116 cout <<
"The bag is empty." << endl;
143 cout <<
"Add Item:" << endl;
146 if(bag[bagNum].add(item))
148 cout << item <<
" was successfully added to bag " << bagNum << endl;
152 cout << item <<
" was not added to the bag." << endl;
165 cout<<
"Would you like to save the bag to a file? (Y/N) ";
166 getline(cin, saveBagFlg);
167 if(saveBagFlg[0] ==
'Y' || saveBagFlg[0] ==
'y')
169 cout<<
"Goodbye!"<< endl;
173 cout <<
"\nError! Invalid option. Please try again.\n\n";
197 cout<<
"Enter the filename that contains the bag: ";
198 getline(cin, filename);
200 fin.open(filename.c_str());
202 cout<<
"ERROR - could not open file " << filename<<endl;
207 while(success && getline(fin,item)){
208 success = bag.
add(item);
210 if (!success) cout <<
"Not all items added to the bag!" << endl;
222 cout <<
"Bag will be saved when implemented" << endl;