fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. double price, totalTax, totalSale;
  8. double stateTax = .04;
  9. double countyTax = .02;
  10.  
  11. cout << "Enter the amount of the purchase: \n";
  12. cin >> price;
  13.  
  14. stateTax = stateTax * price;
  15. countyTax = countyTax * price;
  16. totalTax = stateTax + countyTax;
  17. totalSale = totalTax + price;
  18.  
  19. cout << "The amount of the purchase is: " << price << "\n";
  20. cout << "The state tax is: " << stateTax << "\n";
  21. cout << "The county tax is: " << countyTax << "\n";
  22. cout << "The total amount of tax is: " << totalTax << "\n";
  23. cout << "the total of the sale is: " << totalSale << "\n";
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Enter the amount of the purchase: 
The amount of the purchase is: 6.64593e-316
The state tax is: 2.65837e-317
The county tax is: 1.32919e-317
The total amount of tax is: 3.98756e-317
the total of the sale is: 7.04468e-316