Question: /* File: inventory.cpp This program declares five vectors id, type, cost, price, and quantity, and passes them to two functions read() and write(). - The

/* File: inventory.cpp

This program declares five vectors id, type, cost, price, and quantity, and passes them to two functions read() and write().

- The read() function prompts the user repeatedly for data and reads them into vector elements. The program stops reading when an item number of `0' is entered.

- The write() function prints the vectors to the screen.

For example, the following transactions may take place:

Enter item number (0 to quit): 1 Enter the type ('a' = appliance or 'e' = electronic): a Enter the cost: 1500 Enter the price: 1750 Enter the number in stock: 45

Enter item number (0 to quit): 2 Enter the type ('a' = appliance or 'e' = electronic): z Enter the cost: 2799 Enter the price: 3000 Enter the number in stock: 130

Enter item number (0 to quit): 0

item number: 1 type : appliance cost : 1500.00 price : 1750.00 # in stock : 45

item number: 2 type : invalid type cost : 2799.00 price : 3000.00 # in stock : 130

*/

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!