Question: 8) a) Create a file containing the following car numbers, number of miles driven, and number of gallons of gas used by each car (do
8) a) Create a file containing the following car numbers, number of miles driven, and number of gallons of gas used by each car (do not include the headers): Car No.Miles Driven Galons Used 54 62 71 85 97 250 525 123 1322 235 19 38 86 14 b) Write a C+ program that reads the data in the file created in Question-8a and displays the car number, miles driven, gallons used, and the miles per gallon for each car. The output should also display the total miles driven, total gallons used, and average miles per gallon for all the cars. These totals should be displayed at the end of the output report as shown below. Hint( by using while loop) CWindowslsystem32icmd.exe Car No.Miles Driven als Used Miles/Gallon 13.1579 13.8158 20.5 15.3721 16.7857 258 19 38 123 1322 85 97 86 14 Total niles driven 2455 otxagd nloes pur gallon for all cara - 15.061:3 Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
