Question
Write a program using c++ that reads the item number, cost and quantity for 25 items from a data file named parts.txt. The data for
Write a program using c++ that reads the item number, cost and quantity for 25 items from a data file named parts.txt. The data for each part is on a separate line, with values separated by spaces. Store the data in 3 parallel arrays, an array of integers for the item numbers, an array of floats or doubles for the prices, and an array of integers for the quantities.
Your program should sort the data in parallel, putting the item numbers into increasing order and keeping the prices and quantities in parallel with the item numbers. Print the sorted data to the monitor using cin and cout with setw, fixed, and setprecision to print the data in table format.
Your program should then enter a loop which: 1. Reads an item number from the user.
2. Displays the cost and quantity for that item, using a binary search algorithm.
3. Exits when an appropriate sentinel value is entered.
The program should be modular, with separate functions to read the data, sort, print the summary table, search, and print the results of a search.
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