Problem with showing net salary
Jan 7, 2018 at 2:27am UTC
Pretty much trying to figure out the net salary but it wont show when i try to enter number..
Example: enter basic pay: 35050
net sal:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#include<iostream>
using namespace std;
int main()
{
float base, tax, net;
cout << "enter basic pay" ;
cin >> base;
if (base <= 19500)
{
net = base;
}
else if (base >= 19501 && base <= 28000) {
net = (base - 19501)*0.2;
}
else if (base >= 28001 && base <= 36300) {
net = (base - 28001)*0.25 + (28000 - 19500)*0.2 + 19500 * 0.0;
}
else if (base >= 36301) {
net = (base - 28001)*0.30 + (28000 - 19500)*0.2 + 19500 * 0.0;
}
cout << "net sal: " << endl;
cin >> net;
return 0;
system("pause" );
}
Last edited on Jan 7, 2018 at 2:37am UTC
Jan 7, 2018 at 2:51am UTC
I am assuming the variable net
is the net salary. If so, then line 33 should be something like cout << net;
When I am looking at your code, line 33 is asking for the user to input (cin) the net.
Topic archived. No new replies allowed.