Answer:
Step-by-step explanation:
#include <iostream>
using namespace std;
#include <iostream> // For cout and cin
#include <string> // For string objects
#include "Bag.h" // For ADT bag
using namespace std;
int main()
{
int y=0;
string clubs[] = { "eggs", "eggs", "eggs", "orange", "bread", "bread" };
Bag<string> grabBag;
Bag<string> fragileBag;
for (int x = 0; x < 6; x++) {
grabBag.add(clubs[x]);
}
int count = 0;
for (int q = 0; q < 6 ; q++)
{
if (clubs[y] == "eggs" || clubs[y] == "bread") {
fragileBag.add(clubs[y]);
if(grabBag.remove("eggs")){
++count;
}
}
y++;
}
cout << "fragile bag contains:" << endl;
fragileBag.displayBagContents();
cout << "grocery bag contains:" << endl;
grabBag.displayBagContents();
cout << "Number of items removed from grocery bag : " << count<<endl;
return 0;
};