I am mid way through a program that will calculate the gross pay for a group of employees (output in table format). The function "Get_input" prompts the user to enter the hours worked per the id_number. However, I cannot get the values entered to return back to the main function (and structure?). Not really sure what I missing. Any help will be greatly appreciated.
Code:
#include <stdio.h>
/* Define Constants */
#define NUM_EMPL 5
#define OVERTIME_RATE 1.5f
#define STD_HOURS 40f
{
long id_number;
float wage;
float hours;
float overtime;
float gross;
};
/* define prototypes here for each function except main */
void Get_input (struct employee employeeData [], float hours []);
void Output_results_screen (struct employee []);
int main()
{
/* Variable Declaration and initialization */
struct employee employeeData[NUM_EMPL] = {
{98401, 10.60},
{526488, 9.75},
{765349, 10.50},
{34645, 12.25},
{127615, 8.35}
}, hours[NUM_EMPL], overtime, gross;
/* Function call to output results to the screen in table format. */
Get_input (employeeData, hours);
Output_results_screen (employeeData);
system("PAUSE");
return 0;
} /* main */
/*****************************************/
/* Function: Get_input */
/*****************************************/
void Get_input (struct employee employeeData[], float hours[])
{
/*Local Variable Declaration*/
int i; /* Variable for Loop Index*/
/*Get Employees Hours and Store them in an array*/
for (i = 0; i < NUM_EMPL; i++)
{
printf ("Enter the number of hours worked by Employee # %06li:", employeeData[i].id_number);
scanf ("%f", &hours[i]);
}
} /* Get_input */
/*****************************************/
/* Function: Output_results_screen */
/*****************************************/
void Output_results_screen (struct employee employeeData[])
{
int i; /* loop index */
printf("\n\n---------------------------------------\n");
printf("Clock Wage Hours OT Gross \n");
printf("---------------------------------------\n");
/* printf information about each employee */
for (i = 0; i < NUM_EMPL ; ++i)
{
printf("%06li %5.2f %4.1f %4.1f %6.2f\n",
employeeData[i].id_number, employeeData[i].wage, employeeData[i].hours, employeeData[i].overtime, employeeData[i].gross);
} /* for */
} /* Output_results_screen */