Structures Arrays and Char Strings
Hey whats up fellows. I'm taking C programming and Anaytical Geometry over a one month winter semester. Yah its a *****. Anyway the i've been having problems finding examples of the prgram we need to create anywhere on the internet. we're asked to incorporate the following facilitating the use of character strings:
Accepts ten employee records (structures) from the screen
employee number
employee name
hours worked
pay rate
Displays the records to the screen with a gross pay calculated from hours worked and pay rate
Displays totals for hours worked and gross pay; and averages for hours worked, pay rate, and gross pay
Sort the records in ascending employee name order.
More than one function must be used (main, input, output) or (main, input, output, sort).
but theres no example of this anywhere on the internet or in the C book , trust me i've looked. heres what i have so far but theres complier erros. i'm so stuck please help.
#include<stdio.h>
struct work {
char emp_number[4];
char name[20];
int hours[5];
int rate[4];
};
struct work list[10];
void main(){
/************
LOOP TO INPUT THE DATA FOR 10 PEOPLE
************/
{
int i, emp_hours, emp_rate;
for(i=0;i<10;i++){
printf("Enter employee number: ");
scanf("%s", list[i].emp_number);
printf("Enter name: ");
scanf("%s", list[i].name);
printf("Enter hours worked: ");
scanf("%d", list[i].hours);
printf("Enter hourly rate: ");
scanf("%d", list[i].rate);
}
printf("\n");
printf("EMP# Name Hours Rate\n");
printf("=== ==== ======= ======\n");
{
/*Calculate Gross Pay */
hours(sum= sum + individual;
#include<stdio.h>
}
}
whats wrong why wont it let me add the elements of the structure please help