fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. int main() {
  5. double sales, discount, tax, total;
  6.  
  7. std::cout << "Enter sales amount: ";
  8. std::cin >> sales;
  9.  
  10. discount = sales * 0.15;
  11. tax = sales * 0.07;
  12. total = (sales - discount) + tax;
  13.  
  14. std::cout << std::fixed << std::setprecision(2);
  15. std::cout << "Discount: " << discount << " Baht\n";
  16. std::cout << "Total amount due: " << total << " Baht\n";
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
Enter sales amount: Discount: 0.00 Baht
Total amount due: 0.00 Baht