Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.         const double milk=3.00;
  6.         const double bread=1.00;
  7.         const double apple=0.89;
  8.         double total;
  9.         double final;
  10.         int a,b,c;
  11.  
  12.         cout<<"please enter the amount of milk:" << endl;
  13.         cin>>a;
  14.         cout<<"please enter the amount of bread:" << endl;
  15.         cin>>b;
  16.         cout<<"please enter the amount of apple:" << endl;
  17.         cin>>c;
  18.  
  19.         total=(a*milk)+(b*bread)+(c*apple);
  20.  
  21.         if(total<15) {
  22.                 cout<<"tax=7%" << endl;
  23.                 final=total*0.07;
  24.         }
  25.         else {
  26.                 cout<<"tax=8%" << endl;
  27.                 final=total*0.08;
  28.         }
  29.         cout<<"final supermarket price: " << final << endl;
  30.         return 0;
  31. }