i need help and corrections pls


i created an application c++ for the following problem and i would like to get some suggestions and corrections from you guys pls... and thank you....

here is the problem

Allenton Water Department wants a program that calculates a customer's monthly water bill. The clerk will enter the current and previous meter readings. The program should calculate and display the number of gallons of water used and the total charge for the water. The charge for the water is $7 per 1000 gallons. However, there is a minimum charge of $16.67( in other words every customer must pay at least 16.67).

here is what i have come up with but once i debugg and run it i got some erros.

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:";
cout<<" Enter the previous readings:";

//calculates the gallons used

//calculates the total charge
If (totalCharge=<16.67)
total charge=16.67;

cout<<"totalCharge":<< totalCharge << endl;
}// end of main function
you forgot the semi colons(';'), in both <cin>>....>
Yeah you forgot the trailing semi-colons, to show that you've ended the statement
Oh yeah and besides that does the statements seems logical...if you see anything wrong let me know plz
something my teacher would say is that you need to have spaces before and after the operators. for example
totalCharge = 16.67 or gallonsUsed = currentReadings - previousReadings
the total charge in the if statement has a space as a variable?? this didn't compile did it?
Last edited on
It doesnt i think something wrong with the statemnt its getting hard lolllll
Waiting for more suggestions plz
Waiting for more error messages.


1 error fixed


2 errors fixed


3 errors fixed

return 0;

4 errors fixed

Ok thx ill fix them and run system.hopeffuly.is gunna work this time
Topic archived. No new replies allowed.