I am currently new to computer programming and I have to write a program for my class. I need to write a program that calculate the gross pay an employee earns. the employee makes 16.78 an hour and if he works over 40 weeks he gets paid 1.5 times that rate. if the worker has 3 or more dependents 35 dollars is taken out of the wage. in the end, 25% is taken away in tax. I will post my code below. When I go to compile (g++ compiler) it says that it expected an "if" before my "else" but I have an if before the else. Any hep is appreciated.
#include <iostream>
using namespace std;
int main()
{
//declarations
int hours, dependents;
double grossPay, rate;
cout << "Enter the hourly rate of pay: $";
cin >> rate;
cout << "Enter the number of hours worked,\n";
cin >> hours;
An errant semi-colon is one of the more common beginner (and not-so beginner) problems, and can be hard to notice. I do have an idea of how long it has been kicking you. :)
BTDT more often than I care to remember or admit.
Reading the ENTIRE error message usually helps to locate the problem. The source of the error might not be at the exact line the compiler says it is at. Look a few lines up and lo!