Question: C + + Classes and vectors / classes . The program first reads integer purchaseCount from input, representing the number of pairs of inputs to

C++ Classes and vectors/classes. The program first reads integer purchaseCount from input, representing the number of pairs of inputs to be read. Each pair has a string and a character, representing the purchase's food and option, respectively. One Purchase object is created for each pair and added to vector purchaseList.If a Purchase object's option is equal to 'B', call the Purchase object's Print() function.
Example: If the input is: 3
egg B bamboo A corn B
then the output is:
Purchase: egg, Option: B
Purchase: corn, Option: B

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!