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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started