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; cout