I'm a newbie to this forum and programming in general, but I can still usually figure out my compiling errors. This one, however, has me stumped...
The point of the program is to create a database of employee records using structs and arrays. Everything worked and compiled perfectly until I reached the part of program that calculates the number of employees close to retirement (in this case that means they have been employed for 15 years or more) and then displays their name.
my error message was: lab9.c.61: error: expected expression before ,Ao= ,Ao token
I was trying to use a for-loop to cycle through each struct, and if the value of "years" (years the person has been employed) is greater than or equal to 15 then the program would print their name and add +1 to the variable "total_retirement." I originally had a separate function for this, but got the same compiling error. I moved the code into the main body just in case the error had to do with passing structs to a separate function and all that, but still am getting the error so I guess that's not the case.
The code is a little long, including everything just in case. Problem area is in bold, specific line is in italics.
void print_records (EMPLOYEE values, int size);
int number_of_employees = 0;
printf(“Welcome! How many employee recores will you be storing? \n”);
for (x = 0; x < number_of_employees; x++)
printf(“Enter the last name for employee (%d): \n”, x + 1);
prinf(“Enter job title: \n”);
prinf(“Enter salary: \n”);
prinf(“Enter years employed: \n”);
printf(“Thank you. Here is a listing of all your employees: \n\n”);
for (x = 0; x < number_of employees; x++)
sum = sum + employees[x].salary;
printf(“The total salary expense is %.2lf \n”, sum);
average_salary = (sum / number_of_employees);
printf(“The average salary is %.2lf \n”, average_salary);
int total_retirement = 0;
for (y = 0; y < number_of_employees; y++)
total_retirement = total_retirement;
printf(“Total number of employees close to retirement: %d \n”, total_retirement);
void print_records(EMPLOYEE values, int size)
for (x = 0; x < size; x++)
printf(“Name: %s\n”, values[x].name);
printf(“Job title: %s\n”, values[x].jobtitle);
printf(“Salary: %.2lf \n”, values[x].salary);
printf(“Years employed: %d \n”, values[x].years);