Guest User

Function Troubles

a guest
Jul 20th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.43 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<Windows.h>
  4. #include<string>
  5.  
  6. using namespace std;
  7.  
  8. double taxrateCalculator(double subtotal, double taxRate);
  9. double tiprateCalculator(double costofmeal, double tipRate, int tipSelect);
  10.  
  11. int main()
  12. {
  13.     double walletcontents = 60, taxRate = 10 / 100, costofmeal, subtotal, bullets, remainder, mealTotal;
  14.     int mealselect, storydecision1, storydecision2;
  15.     string name, location;
  16.     int tipSelect;
  17.    
  18.     cout << "Flavor Text...";
  19.     cout << endl;
  20.     cout << "Flavor Text...";
  21.     cout << endl;
  22.     system("pause");
  23.     system("cls");
  24.     cout << "Name Query?" << endl;
  25.     cin >> name;
  26.     cout << "Flavor Text..." << name << " Flavor Text....";
  27.     cout << endl;
  28.     system("pause");
  29.     system("cls");
  30.     cout << "Location Question?";
  31.     cin >> location;
  32.     cout << endl << "Flavor Text...";
  33.     system("pause");
  34.     system("cls");
  35.     cout << "                   Menu Prototype                ";
  36.     cout << endl << endl;
  37.     cout << "Option 1.                      $35.00" << endl;
  38.     cout << "Option 2.                      $45.00" << endl;
  39.     cin >> mealselect;
  40.  
  41.     if (mealselect = 1)
  42.     {
  43.         subtotal = 35;
  44.         costofmeal = 35;
  45.         cout << "Response";
  46.         system("pause");
  47.         system("cls");
  48.     }
  49.  
  50.     else if (mealselect = 2)
  51.     {
  52.         subtotal = 45;
  53.         costofmeal = 45;
  54.         cout << "Response";
  55.         system("pause");
  56.         system("cls");
  57.     }
  58.  
  59.     cout << "Tip menu!";
  60.     cout << endl << "1. 20%";
  61.     cout << endl << "2. 15%";
  62.     cout << endl << "3. 10%";
  63.     cout << endl << "4. 5%";
  64.     cin >> tipSelect;
  65.     system("pause");
  66.     system("cls");
  67.    
  68.    
  69.  
  70.     double totalTax = taxrateCalculator(subtotal, taxRate);
  71.     double totalTip = tiprateCalculator(costofmeal, tipRate, tipSelect);
  72.  
  73.     cout << "Story Response. Bullet Query." << endl;
  74.     cout << "Your meal was  $" << costofmeal << endl;
  75.     cout << "Your total tax is $" << totalTax << "      " << endl;
  76.     cout << "";
  77.    
  78.  
  79.     system("pause");
  80.  
  81. }
  82.  
  83. double taxrateCalculator(double subtotal, double taxRate)
  84. {
  85.     taxRate = subtotal * 10 / 100;
  86.     return taxRate;
  87. }
  88.  
  89. double tiprateCalculator(double costofmeal, double tipRate, int tipSelect)
  90. {
  91.     double tip;
  92.     while (tipSelect = 1)
  93.     {
  94.         tip = costofmeal * (20 / 100);
  95.         return tip;
  96.     }
  97.  
  98.     while (tipSelect = 2)
  99.     {
  100.         tip = costofmeal * (15 / 100);
  101.         return tip;
  102.     }
  103.  
  104.     while (tipSelect = 3)
  105.     {
  106.         tip = costofmeal * (10 / 100);
  107.         return tip;
  108.     }
  109.  
  110.     while (tipSelect = 4)
  111.     {
  112.         tip = costofmeal * (5 / 100);
  113.         return tip;
  114.     }
  115.  
  116.     tipRate = tip * 1;
  117.     return tipRate;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment