12345678910111213141516171819202122232425262728293031323334353637383940
#include <iostream> #include <iomanip> using namespace std; int main() { //declare variables double reading1 = 0.0; double reading2 = 0.0; double gallonsUsed = 0.0; double totalCharge = 0.0; //enter meter readings cout << "Enter previous meter reading: "; cin >> reading1; cout << "Enter current meter reading: "; cin >> reading2; //subtract previous reading from current reading gallonsUsed = reading2 - reading1; cout << "gallonsUsed = " << gallonsUsed << endl; cout << fixed << setprecision(2) << endl; totalCharge = gallonsUsed / 1000 * 7; cout << "totalCharge = " << totalCharge << endl; //calculate the total charge if (gallonsUsed < 1000) { totalCharge = 16.67; cout << "totalCharge = " << totalCharge << endl; } else { totalCharge = gallonsUsed / 1000 * 7; } system("pause"); return 0; } //end of mani()