{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


sec03_aakashs_gascostwhile - cin>> option break...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <iomanip> using namespace std; int main () { float gallons; float price; float option; cout<<"Amount of Gas Bought"<< endl; cin>> gallons; cout<<"Press 0 If You Are Paying With Cash, Press 1 If You Are Paying With Credit Card"<<endl; cin>>option; while(option != 1 && option !=0){ cout<<"Invalid option. Please Retype option." << endl; cout<<"Invalid Entry. Please Re-eneter Using Correct Variable."<< endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin >> option; break;} if (option==0) { price= 3.021*gallons; cout<<"You will pay: $"<< setprecision(2)<< fixed << price<< endl; } if (option==1) { price= 3.121*gallons; cout<<"You will pay: $"<< setprecision(2) << fixed<< price<< endl; } return 0; } /*Collaborated with Shiv Desai section 3 and Cameron DeAngelis section 05*/...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online