Advertisement
Maco153

Tax

Oct 21st, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. bool addTax(float x, float &tax) {
  4.  
  5.     if (x > 50) {
  6.         tax = x * (1 + tax / 100);
  7.         return 1;
  8.  
  9.     }
  10.     else {
  11.         return 0;
  12.  
  13.     }
  14.  
  15. }
  16. int main() {
  17.     float value = 0;
  18.     float tax = 0;
  19.     int flag;
  20.     cout << "Enter the value of the item \n";
  21.     cin >> value;
  22.     cout << "Enter the value of the percantage of taxes\n";
  23.     cin >> tax;
  24.  
  25.     flag =addTax(value, tax);
  26.     if (flag) {
  27.         cout << "The item is taxable " << endl;
  28.         cout << "The cost after adding taxes is " << tax << endl;
  29.     }
  30.     else {
  31.         cout << "The item is intaxable  \n";
  32.     }
  33.     return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement