Drivers are concerned with the mileage obtained by their automobiles.One driver
ID: 3624470 • Letter: D
Question
Drivers are concerned with the mileage obtained by their automobiles.One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful.Develop a C++ program that uses while statement to input 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 tankfuls up to this point.The program should terminate with a sentinel value.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.