fork download
  1.  
  2. /*******************************************************************************
  3. * Calculate Total Meal Cost With Set Price, Tax and Tip Info
  4. *__________________________________________________________
  5. * Uses set meal charge with set tip and set tax to calculate the total cost
  6. *____________________________________________________________
  7. *OUTPUT
  8. * Code prints all variables and the sum of them
  9. *******************************************************************************/
  10. #include <iostream>
  11. using namespace std;
  12.  
  13. int main() {
  14. float mealCharge = 44.50;
  15. float taxAmount = mealCharge * 0.0675;
  16. float tipAmount = (mealCharge + taxAmount) * 0.15;
  17.  
  18. cout << "mealCharge: " << mealCharge << endl;
  19. cout << "taxAmount: " << taxAmount << endl;
  20. cout << "tipAmount: " << tipAmount << endl;
  21. cout << "Total: " << tipAmount + taxAmount + mealCharge << endl;
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
mealCharge: 44.5
taxAmount: 3.00375
tipAmount: 7.12556
Total: 54.6293