I need help with this

Sep 12, 2018 at 5:29pm
Im trying to compute the base pay, overtime pay ad gross pay
[code]
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
int hoursWorked;
double hourlyRate, grossPay;

cout << "Enter the hourly rate of pay; $";
cin >> hourlyRate;
cout << "Enter the number of hours worked, " <<endl;
cout << "rounded to a whole number of hours:";
cin >> hoursWorked;

grossPay = hourlyRate * hoursWorked;//calculate gross pay

cout << fixed << setprecision(2);

cout << "Hours worked = " << hoursWorked << endl;
cout << "Hourly pay rate = $" << hourlyRate << endl;
cout << "Gross pay = $" << grossPay << endl;

return 0;
[/code}

Last edited on Sep 13, 2018 at 2:35pm
Sep 12, 2018 at 5:36pm
Please edit your post you made and use proper code formatting. This means putting [code] and [/code] around your code.

That isn't your full, verbatim code. You left out a closing }. Also, if( (hoursWorked - 40) > = 4), > = is not an operator, it must be >= without spaces.
eles is not a keyword, you mean else... proofread :)
Sep 12, 2018 at 6:54pm
Damn, Gandhi came back among us to code :3
Sep 12, 2018 at 7:35pm
Once you get the code to compile and run, check your algorithm. You're computing and printing the base pay OR the overtime pay, but not both.
Topic archived. No new replies allowed.