0

This program is suppose to display MPG's (total), and the combined MPG of all the total MPG's you input.

```
// Exercise 4. 12: ex04_12.cpp
#include <iostream>
using namespace std;
int main()
{
double mpg;
double gallons;
double combinedMpg = 1;
double total;
while ( mpg != -1 )
{
cout << "\nEnter miles (Enter -1 to quit): ";
cin >> mpg;
if ( mpg != -1)
{
cout << "Enter gallons: ";
cin >> gallons;
}
cout << "\nMPG this tankful: " << (total = (mpg / gallons)) << endl;
cout << "Total MPG: " << (combinedMpg = total / combinedMpg ) << endl;
}
}
```

Any help?

Output should be along these lines...I just switched some of the words.

Enter the miles used (-1 to quit): 287

Enter gal l ons: 13

MPG this tankful : 22. 076923

Total MPG: 22. 076923

Enter the miles used (-1 to quit): 200

Enter gal l ons: 10

MPG this tankful : 20. 000000

Total MPG: 21. 173913

Enter the miles used (-1 to quit): 120

Enter gal l ons: 5

MPG this tankful : 24. 000000

Total MPG: 21. 678571

*Edited 7 Years Ago by BenJammin89*: n/a