Error expected initializer before 'int'
Aug 5, 2013 at 3:43pm UTC
Hi There
I am new to c++ and I am doing a assignment of it. The question involves me writing a program using a overloaded function to calculate the Weekly rate of employees but they get paid hourly and weekly.
I get this error but do not know why, could you please help me out.
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
#include <iostream>
using namespace std;
int calcWeeklyPay(int paidWeekly, int annualSalaryWeekly)
//Returns the Weekly salary of weekly paid Employees
int calcWeeklyPay(int paidHourly, int annualSalaryHourly)
//Returns the Weekly salary of Hourly paid Employees
int main()
{
int paidWeekly, paidHourly, annualSalaryWeekly, annualSalaryHourly, hoursWorked
cout << "Please Enter Your Annual Salary"
<< "of a Weekly Paid Employee:" ;
cin >> annualSalaryWeekly;
paidWeekly=annualSalaryWeekly/52
cout<<"The Annual Salary for the weekly paid employee is:" <<paidWeekly
<< endl;
cout << "Please Enter Your Annual Salary"
<< "of a Hourly Paid Employee:" ;
cin >> annualSalaryHourly;
cout<< "Enter Hours Worked" ;
cin >> hoursWorked;
paidHourly=annualSalaryHourly/hoursWorked
cout<<"The Annual Salary for the hourly paid employee is:" <<paidHourly
<< endl;
return 0;
}
I am very new to this so If it is totaly wrong, tell me and I will work on it some more
Aug 5, 2013 at 3:46pm UTC
Hi,
You are missing vital ; after every operation. for example after:
paidWeekly=annualSalaryWeekly/52
you should include a ; after the above code so the final code should look like this:
paidWeekly=annualSalaryWeekly/52;
Thanks!
Aug 5, 2013 at 3:46pm UTC
Looks like you are missing a few semicolons at the end s of some lines.
Aug 5, 2013 at 3:47pm UTC
You need to end the following lines with a semi-colon:
4, 7, 13, 19, 31
Topic archived. No new replies allowed.