sec03_aakashs_gascostwhile - cin >>...

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; 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 &gt;&gt; option; break;} if (option==0) { price= 3.021*gallons; cout&lt;&lt;&quot;You will pay: $&quot;&lt;&lt; setprecision(2)&lt;&lt; fixed &lt;&lt; price&lt;&lt; endl; } if (option==1) { price= 3.121*gallons; cout&lt;&lt;&quot;You will pay: $&quot;&lt;&lt; setprecision(2) &lt;&lt; fixed&lt;&lt; price&lt;&lt; endl; } return 0; } /*Collaborated with Shiv Desai section 3 and Cameron DeAngelis section 05*/...
View Full Document

This note was uploaded on 03/30/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.

Ask a homework question - tutors are online