Question: Question [65 Marks] Write a complete C++ program. The program uses various types of structured data developed to calculate the profit of each item, the
Question [65 Marks] Write a complete C++ program. The program uses various types of structured data developed to calculate the profit of each item, the total amount of profit, and the highest profit. The program should perform the following tasks: Task 1: Declare a structure named Item, with the following members: (3 marks) a) Code b) Name c) Cost d) Sale price e) Number of items sold f) Profit Task 2: Write a function named readinput. (10 marks) a) It receives an array of Item of type struct. b) The function should read data from the given input text file named input.txt. The file contains items' codes and the number of items sold. Figure 1 shows an example of data that can be used to test the program. c) Assuming you do not know, the number of items. Calculate the number of items sold based on the number of item records found in the input file. d) The function should return the number of items calculated in (c). M101 12 B202 21 C303 15 F4049 F404 27 C303 25 B202 16 M1019 M101 14 C303 26 B202 31 F404 13 M101 9 C303 38 B202 33 Figure 1: Sample data in the input file "input.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
