Quote Originally Posted by ade161 View Post
how does this look?

//ch5 - 13.cpp : calculates and displays number of gallons & total charge for the water
//created/revised by <> on <8-18-10>

#include <iostream>
using namespace std;

int main()
{
//declare variables
float previousReadings = 0.0;
float currentReadings = 0.0;
float gallonsUsed = 0.0;
float totalCharge = 0.0;

//enter input items
cout <<"Enter the current readings:";
cin >> currentReadings;
cout <<"Enter the previous readings:";
cin >> previousReadings;

//calculates the gallons used
gallonsUsed = currentReadings - previousReadings;

//calculates the total charge
if (totalCharge >= 16.67)
{
totalCharge = (gallonsUsed / 1000) *7;
cout <<"totalCharge:" << totalCharge << endl;
}
else
{
totalCharge = 16.67;
cout <<"total charge:" << totalCharge << endl;
}
//end if

cout <<"gallons used:" << gallonsUsed << endl;
cout <<"total charge:" << totalCharge << endl;

return 0;
} //end of main function
There's nothing between these two statements to change the value of totalCharge

float totalCharge = 0.0;
if (totalCharge >= 16.67)