Home > database >  C teachers management information system course design
C teachers management information system course design

Time:09-27

Problem description and requirements:
Define a class TeacherList
Can implement a simple increase teachers'
Can look for teachers implement a simple
Teachers can implement a simple delete
To use binary file read and write operations
Single # include #include #include using namespace std; Class employee {public: the employee () {} the employee (charna [50], char sex [50], int num, char tel [20], char off [50], char pos [50]) : m_number (num) {strcpy (m_name, na); Strcpy (m_sex, sex); Strcpy (m_telephone, tel); Strcpy (m_office off); Strcpy (m_posting, pos); } intgetnum () {returnm_number; } char * getna ()//{returnm_name; } char * getoff () {returnm_office; } char * getposting ()//{returnm_posting; } friendostream& The operator & lt; <(ostream & amp; OS, const employee & amp; S) {os<"Name:" & lt; (cost & amp; Is that the employee & amp; S) {is> S.m _name & gt;> S.m _sex & gt;> S.m _number & gt;> S.m _telephone & gt;> S.m _office & gt;> S.m _posting; Returnis; {}} - the employee () private: charm_name [50]. Charm_sex [50]. Intm_number; Charm_telephone [20]. Charm_office [50]. Charm_posting [50]. }; Voidmenu ()//1) menu function select {cout<"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * teacher information management system * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" & lt; Len. The employee * emp=new employee (len); The fs//open space, save staff data. Open (" guanli. Dat ", the ios: : out | ios: : app | ios: : binary); if (! Fs) cout & lt; <"Openfailed." & lt; Emp [I]; Fs. Write ((char *) & amp; Emp [I], sizeof (emp) [I]);//fs num; Fstream fs. Fs. Open (" guanli. Dat ", the ios: : | in ios: : binary); Fs. Seekg (0, the ios: : end);//int s=fs. At the end of file transferred to tellg ();//tell the file size int n=s/sizeof (employee);//computing staff fs. Seekg (ios: : beg);//file pointer to the beginning the employee * emp=new employee [n]. for (int i=0; i num; Inta=100; for(int i=0; i
  • Related