5. Drivers are concerned with the mileage obtained by their automobiles. One dri
ID: 3759559 • Letter: 5
Question
5. Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankful's of gasoline by recording miles driven and gallons used for each tankful. Develop a C++ program that inputs the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful and print the combined miles per gallon obtained for all tankful's up to this point. The results should look like the following:Explanation / Answer
#include #include #include int Miles_traveled(double &g); double Mileage(int mi,double g); void Display(double mpg); void main() { int miles; double gallons,miles_per_gallon; miles = Miles_traveled(gallons); miles_per_gallon = Mileage(miles,gallons); Display(miles_per_gallon); return; } int Miles_traveled(double &g) { int mi; cout > mi; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.