Else If problem

At a certain point the else does not see the if and thinks that it requires an if. Does anyone know what I can do?

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394`` `````` //Employee Payment Calculator #include using namespace std; int main() { //Employee Options int empManager = 1; int empHourly = 2; int empCommission = 3; int empPiece = 4; int empSelection; int hours; int items; double rate; double sales; double itemValue; double salary; //Do-While Area do { //Employee Selection cout << "What type of employee are you?\n1- Manager\n2- Hourly Worker\n3- Comission Worker\n4- Pieceworker" << endl; cin >> empSelection; //Manager if (empSelection == empManager) cout << "Salary is \$1500 a week!" << endl; //Hourly Worker else if (empSelection == empHourly) cout << "Enter hours worked." << endl; cin >> hours; cout << "Enter hourly rate of the worker. (\$0.00)" << endl; cin >> rate; //Calculate Salary if (hours > 40) salary = (rate * 40) + ((rate * 1.5) * hours - 40); else salary = rate * hours; //Display Salary cout << "Salary is \$" << salary << "!" << endl; //Commission Worker else if (empSelection == empCommission) cout << "Enter the amount of sales\nin money you have made (\$0.00)." << endl; cin >> sales; salary = 250 + (sales * 0.057); cout << "Salary is \$" << salary << "!" << endl; //Pieceworker else if (empSelection == empPiece) cout << "Enter the value you get\nper item. (\$0.00)" << endl; cin >> itemValue; cout << "Enter the amount of items\nyou have worked on." << endl; cin >> items; //Calculate Salary salary = itemValue * items; cout << "Salary is \$" << salary << "!" << endl; //Incorrect Employee Letter else cout << "Incorrect employee letter.\nPlease try again!" << endl; } while (empSelection > 0); return 0; }``````
If there is more then one statement in a loop then you need to use curly brackets.

For example:

 ``123456789`` ``````else if (empSelection == empHourly) { cout << "Enter hours worked." << endl; cin >> hours; cout << "Enter hourly rate of the worker. (\$0.00)" << endl; cin >> rate; } ``````
Thank you so much!
Topic archived. No new replies allowed.