1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Employee:: Employee(char* EID ,char *Namep,char EType,char* D ,char *TelNo ,int C)
{
ifstream in ;
in.open("EMPLOYEE.dat",ios::in) ;
if (in.fail())
{
cerr <<"The Employee file cannot be found" ;
system("pause") ;
exit(1) ;
}
if(strcmp(EID," ") == 0 || (strcmp(Namep," ")==0) || EType == '@',strcmp(D," ") == 0 || strcmp(TelNo," ") == 0 || C == 0)
{
in.get(Department,7);
in >> count ;
in.ignore(20,'\n') ;
in.get(EmployeeID,7) ;
in.get(Name,21) ;
in.get(TelephoneNumber,8),
in >> EmployeeType ;
in.ignore(20,'\n') ;
}
}
ifstream& operator >> (ifstream& infile , Employee& E)
{
infile.get(E.EmployeeID,7) ;
infile.get(E.Name,21) ;
infile.get(E.TelephoneNumber,8) ;
infile >> E.EmployeeType ;
infile.ignore(20,'\n') ;
return infile ;
}
|