代码大全

(singke) #1
C

void ReadEmployeeData
(
EMPLOYEE Employee[MAX_EMPLOYEES];
int * EmployeeCount;
)


{ EMPLOYEE NewEmployee
BOOLEAN ValidRecord;
Char TextChar
int FieldInx;
int CharIdx
FILE* EmployeeFile
int Length


EmployeeFile=OpenEmployeeFile(EmployeeFile);

{Read and check each employee record}
EmployeeCount=0;
ReadEmployeeRec(&NewEmployee);
do
{
/
check each record's validity /
Valid Record=TRUE;
For(FieldIdx 0 FieldIdx NexEmployee.NumFields;FieldIdx++)
{
/
check each record's validity */
Length=strlen(NewEmployee.Field [FieldIdx++])
for(CharIdx=0;CharIdx<Length;CharIdx++)
{
TestChar=NewEmployee.Filed[FieldIdx][CharIdx]
if (!
('a'<=Testchar&& Testchar< 'z'||
('A'<=Testchar&& Testchar< 'Z'||
'0'< Testchar&&Testchar<='9')
ValidRecord=FALSE;
}
}
If( ValidRecord )

Free download pdf