Lee_assig11

# Lee_assig11 - cout.precision(2) int a=0 double b, c, d, e,...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 //Cheu Lee Assig 11 #include <iostream> #include <cmath> using namespace std int main() { double g=0, m=0, mpg=0, avgGallon=0, totalGallon=0, totalMiles=0 while (g!=-1) { totalGallon = totalGallon + g cout<<"Enter the gallons used (-1 to end): "<<endl cin>>g totalMiles = totoalMiles + m if (g!=-1){ cout<<"Enter the miles driven: "<<endl cin>>m mpg = m/g cout<<"The miles per gallon for this tanks was: "<<mpg<<endl } } { avgGallon = totalMiles/totalGallon cout<<"The over all average miles per gallon was: "<<avgGallon<<endl } cout.setf(ios::fixed)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout.precision(2) int a=0 double b, c, d, e, f while(a!=-1){ cout<<"Enter account number (-1 to end):"<<endl cin>>a if(a!=-1){ cout<<"Enter beginning balance:"<<endl cin>>b cout<<"Enter total charges:"<<endl cin>>c cout<<"Enter total credit:"<<endl cin>>d cout<<"Enter credit limit:"<<endl cin>>e f=(b+c-d) if(f<e) cout<<"Balance: "<<f<<endl else{ cout<<"Account: "<<a<<endl cout<<"Credit Limit: "<<e<<endl cout<<"Balance: "<<f<<endl cout<<"Credit Limit Exceeded."<<endl } } } Sheet1 Page 2 return 0 }...
View Full Document

## This note was uploaded on 05/16/2010 for the course CISCO EST61 taught by Professor Miller during the Spring '10 term at Fresno City College.

### Page1 / 2

Lee_assig11 - cout.precision(2) int a=0 double b, c, d, e,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online