Question: Question 1. Write using C++. a. Create a function that writes to a file named cars.txt the information of 8 cars. Ask the user for
Question 1. Write using C++.
a. Create a function that writes to a file named cars.txt the information of 8 cars. Ask the user for the plate number, number of miles driven and number of gas used in each car and write it to the file.
b. Create a function that reads the file and stores the miles driven and gallons used to two different arrays.
c. Create a function that computes the total miles driven, total gallons used and average miles per gallon for all the cars.
d. Implement all function inside the main program and all the computed values should be displayed appropriately.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
