/* June 28, 1998 */
/* Program to print the name, ID number, pay, hrs and total pay using user-defined structure types */
#include
#define STRSIZ 30
typedef struct {
char name[STRSIZ];
int id;
double pay_rate;
double hours;
} employee_t;
main ()
{
employee_t emp1;
employee_t emp2;
employee_t emp3;
strcpy(emp1.name, "Joe");
emp1.id = 1001;
emp1.pay_rate = 4.5;
emp1.hours = 8;
strcpy(emp2.name, "Smith");
emp2.id = 1002;
emp2.pay_rate = 5.5;
emp2.hours = 9;
strcpy(emp3.name, "Pete");
emp3.id = 1003;
emp3.pay_rate = 4.75;
emp3.hours = 8.5;
printf("\n Employee name = %s", emp1.name);
printf("\n Employee ID = %d", emp1.id);
printf("\n Employee pay rate = $%.2f", emp1.pay_rate);
printf("\n Employee hours = %.1f", emp1.hours);
printf("\n Total Pay = $%.2f\n", emp1.pay_rate * emp1.hours);
printf("\n Employee name = %s", emp2.name);
printf("\n Employee ID = %d", emp2.id);
printf("\n Employee pay rate = $%.2f", emp2.pay_rate);
printf("\n Employee hours = %.1f", emp2.hours);
printf("\n Total Pay = $%.2f\n", emp2.pay_rate * emp2.hours);
printf("\n Employee name = %s", emp3.name);
printf("\n Employee ID = %d", emp3.id);
printf("\n Employee pay rate = $%.2f", emp3.pay_rate);
printf("\n Employee hours = %.1f", emp3.hours);
printf("\n Total Pay = $%.2f\n", emp3.pay_rate * emp3.hours);
printf("\n");
}
               (
geocities.com/yosemite/rapids)                   (
geocities.com/yosemite)