Answered step by step
Verified Expert Solution
Question
1 Approved Answer
12. (95) Create a program that reads in the name and price of several items from the file, final.txt, and store the information in an
12. (95) Create a program that reads in the name and price of several items from the file, final.txt, and store the information in an array of Items. You will then prompt the user for a command and then process that command. The file uses one line to hold a name and then a price (float). The Itenm structure is given below: struct Item char *name; float price; 1) Define a 30 element array of Items. 2) Read in the data from the file and add the information about each item to the array until the end of the file is reached. 3) Next, prompt the user with the following command prompt: Commands 1 - List all 2 - Display item 3 - Display last 4- Quit Command> The List all command will display all of the items in the array . The Display item command will prompt the user for an index and then display the item with that index in the array. The Display last command will display the last item in the array The Quit command will terminate the program. Implement the first three commands as functions. Uis a funcion clld fiplay to display asingle iem eh tine an tem needs to be displayed. Submit the source code and your program's output
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