Question: C++ Programming Array A car dealer has 10 salespersons. Each salesperson keeps track of the number of cars sold each month and reports it to

C++ Programming Array

A car dealer has 10 salespersons. Each salesperson keeps track of the number of cars sold each month and reports it to the management at the end of the month. The management keeps the data in a file and assigns a number, 1 to 10 to each salesperson. The following statement declares an array, cars, of 10 components of type int to store the number of cars sold by each salesperson.

Int cars[10];

Write the C++ code to store the number of cars sold by each salesperson in the array cars, output the total number of cars sold at the end of each month, and output the salesperson number selling the maximum number of cars. (Assume the data is in the file cars.dat. and this file has been opened using ifstream variable inFile.)

CAR SALES DATA: 1 5 2 7 3 6 4 1 5 2 6 5 7 4 8 4 9 6 10 5 

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 Databases Questions!