no output?

When i try my program i get an input screen but no output screen, i dont know what to do, How do i make it work?
the output screen should display the following:
Hours Worked : (number)
Hourly Rate: (number)
Tax Rate: (number)
Gross Pay: (number)
Taxes: (number)
Net Pay: (number)
code:
#include <iostream>
using namespace std;

int main()
{
double x,y,taxrate,grosspay,tax,netpay;

cout << "enter hours worked ";
cin >> x;

cout << "enter hourly rate ";
cin >> y;

grosspay=x*y;
while(grosspay>=0){
if (2000 <= grosspay && grosspay < 2500)
taxrate=.45;
else (1500<=grosspay && grosspay < 2000);
taxrate=.40;
if (1000<= grosspay && grosspay <1500)
taxrate=.35;
else(grosspay=1000);
taxrate=.30;
if(0<=grosspay && grosspay <1000);
taxrate=.30;
}

tax=grosspay*taxrate;
netpay=grosspay-tax;

cout << "Hours worked: " << x << endl;
cout<<"hourly rate:" << y << endl;
cout<<"tax rate:" << taxrate << endl;
cout<<"gross pay:" << grosspay << endl;
cout<<"net pay:" << netpay << endl;



system("pause");
}
end code.
I think you are stuck in an infinite while loop.
@kingsamuraix

You had a few things that messed up the program. The main one was while(grosspay>=0) Since grosspay never decreases, you would always be in the loop. But, even without that, you have a bunch of else( with a misplaced semi-colon, which terminates that statement, that should have been else if(1500<=grosspay && grosspay < 2000).

Here is the program with those small problems, removed.
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
#include <iostream>
using namespace std;

int main()
{
double x,y,taxrate,grosspay,tax,netpay;

cout << "enter hours worked ";
cin >> x;

cout << "enter hourly rate ";
cin >> y;

grosspay=x*y;

if (2000 <= grosspay && grosspay < 2500)
taxrate=.45;
else if(1500<=grosspay && grosspay < 2000)
taxrate=.40;
else if (1000<= grosspay && grosspay <1500)
taxrate=.35;
else if(grosspay==1000)
taxrate=.30;
else if(0<=grosspay && grosspay <1000)
taxrate=.30;

tax=grosspay*taxrate;
netpay=grosspay-tax;

cout << "Hours worked: " << x << endl;
cout << "hourly rate:" << y << endl;
cout << "tax rate:" << taxrate << endl;
cout << "gross pay:" << grosspay << endl;
cout << "net pay:" << netpay << endl;

system("pause");
}
Try to rewrite the code without the loop stuff.

Find a way past
thanks for the help
Topic archived. No new replies allowed.