I cant get one of my lines to dispay

I'm a new programmer in my first class. I am supposed to write a code that calculates gross/net pay from hours and hourly rate. When you run the program it starts out blank but if you type numbers it will enter it in as hours worked. Then ask for hourly rate. Can someone share some light on why this is occurring?

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  #include <iostream>

using namespace std;


//Main function

int main()

{

    int hoursWorked;

    double payRate, grossPay, taxes, netPay, Taxpercent;

    //Reading number of hours worked (THIS IS WHERE THE PROBLEM IS, This line doesnt display
    
    cout << "\n\nEnter the # of hours worked: ";
    
    cin >> hoursWorked;

    //Reading pay rate

    cout << "\n Enter rate of pay: ";

    cin >> payRate;

  
    //Calculating gross pay

    grossPay = hoursWorked * payRate;


    // Calculating Taxes
    Taxpercent = 0.15;

    taxes = grossPay * Taxpercent;


    //Calculating net pay

    netPay = grossPay - taxes;

    //Printing results

    cout << "\n\n Hours Worked are: " << hoursWorked;

    cout << "\n\n Hourly Wage is: $" << payRate;
    
    cout << "\n\n Gross Pay is: $" << grossPay;

    cout << "\n\n Tax Percent is: %" << (Taxpercent * 100);

    cout << "\n\n Taxes withheld are: $" << taxes;

    cout << "\n\n Net Pay is: $" << netPay;



   

}
Just to be clear -- you're saying that you never see the text "Enter the # of hours worked: " printed out on the screen?

Did you just recently add that line to your code?

cin and cout are tied together (meaning, cout will be flushed to show the text), so you shouldn't need to do anything fancy to get that text to display.

What IDE/compiler are you using? Can you try to clean/rebuild your project?
thank you I just quit out of microsoft visual studio and opened up new project and re doing it and it worked
Topic archived. No new replies allowed.