]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | # include <stdio.h> |
2 | # include <string.h> | |
3 | # include "employee.h" | |
4 | ||
5 | bool employee_setName (employee *e, char na []) | |
6 | { | |
7 | int i; | |
8 | ||
9 | for (i = 0; na[i] != '\0'; i++) | |
10 | { | |
3120b462 | 11 | if (i == maxEmployeeName) |
12 | return FALSE; /* e->name is not defined (new error - 2001-07-12) */ | |
885824d3 | 13 | } |
14 | ||
15 | strcpy (e->name, na); | |
16 | return TRUE; | |
17 | } | |
18 | ||
19 | bool employee_equal (employee * e1, employee * e2) | |
20 | { | |
21 | return ((e1->ssNum == e2->ssNum) | |
22 | && (e1->salary == e2->salary) | |
23 | && (e1->gen == e2->gen) | |
24 | && (e1->j == e2->j) | |
25 | && (strncmp (e1->name, e2->name, maxEmployeeName) == 0)); | |
26 | } | |
27 | ||
28 | void employee_sprint (char s[], employee e) | |
29 | { | |
30 | static char *gender[] ={ "male", "female", "?" }; | |
31 | static char *jobs[] = { "manager", "non-manager", "?" }; | |
32 | ||
33 | (void) sprintf (s, employeeFormat, e.ssNum, e.name, | |
34 | gender[e.gen], jobs[e.j], e.salary); | |
35 | } | |
36 |