Home > database >  Which bosses said to me about the problem
Which bosses said to me about the problem

Time:09-27

#include #include #include #include/* */200/* # define N number of employees accounted for an employee variable bytes */# define LEN sizeof (struct employee) # define FILE_BUFFER_LENGTH 30000/* */# define DATA output FORMAT the FORMAT "% - 10-10 d % s % - 10 s % - 10 s % - 10-14 d % s % - 10-10 d % s \ N"/* set the display content */# define DATA em [I] num, em [I]. Name, em [I] position, em [I] sex, em [I] age, em [I] cult, em [I]. Salary, em [I] statevoid input ();/* input employee information function *///wang lei void display ();/* displays employee information function *///wang lei void change (); Revising their information function/* *///dried plum void the add ();/* additional staff information function *///dried plum void del ();/* *///delete employee information function of cattle QianLong void the count ();/* statistical staff information function *///cow QianLong void searchnum ();/* query staff information function according to employee number *///zhi-yuan zhang void searchname ();/* carried out in accordance with the work number query information function employees *///zhi-yuan zhang void menu1 ();/* query main menu functions */void menu2 ();/* */second degree function char mima1 [9]="00000000"; Char mima2 [9]="12345678";/* information variables */struct employee {int num. Char position [20]. char name[20]; Char sex [2]; int age; Char cult [10]. Int salary; Char state [8]. } em [N]. Void input () {FILE * fp; int i=0; Char choiceinput='y' If ((fp=fopen (" employee. TXT ", "a +"))==NULL) return; While (choiceinput=='y' | | choiceinput=='y') {i++; Printf (" % d a worker \ n ", I); printf("\n"); Printf (" please input the five working: \ n "); for (; (em [I] num) & lt; 10000 | | (em [I] num) & gt; 99999;) {the scanf (" % d ", & amp; Em [I] num); If ((em [I] num) & lt; 10000 | | (em [I] num) & gt; 99999) {printf (" gonghaowu format error, please input again \ n "); }} printf (" \ n "); Printf (" please input position (chairman/general manager/deputy general manager/manager/assistant manager/secretary/technician/boss/employee) : \ n "); The scanf (" % s ", em [I] position); printf("\n"); Printf (" please input the name: \ n "); The scanf (" % s ", em [I] name); printf("\n"); Printf (" please input sex (male/female) : \ n "); The scanf (" % s ", em [I] sex); printf("\n"); Printf (" please enter the age: \ n "); The scanf (" % d ", & amp; Em [I]. Age); printf("\n"); Printf (" please input culture degree (experts/doctor/master/bachelor/other) : \ n "); The scanf (" % s ", em [I] cult); printf("\n"); Printf (" please input the salary: \ n "); The scanf (" % d ", & amp; Em [I]. Salary); printf("\n"); Printf (" please input condition (normal/health/good/bad) : \ n "); The scanf (" % s ", em [I] the state); printf("\n"); Printf (" whether to continue the input? (y/n) \ n "); The scanf (" % s ", & amp; Choiceinput); Fwrite (& amp; Em [I], LEN, 1, fp); } the if (toupper (choiceinput)=='N') {fclose (fp); Printf (" input end, any key to return to the \ n "); Getch (); return; } the return; {} to void the display () the FILE * fp; int i; If ((fp=fopen (" employee. TXT ", "r"))==NULL) return; Printf (" output: \ n "); Printf (" gonghaowu name position sex age culture level salary condition \ t \ n "); For (I=0; Fread (& amp; Em [I], LEN, 1, fp)!=0; I++) {printf (FORMAT, DATA); } printf (" press any key to return to completion \ n "); Getch (); fclose(fp); return; {} void change () the FILE * fp; Int I, j, m=0, snum; If ((fp=fopen (" employee. TXT ", "a +"))==NULL) {printf (" system error, please contact the developers! \n"); return; } while (! The feof (fp)) if (fread (& amp; Em [m], LEN, 1, fp)==1) m++; If (m==0) {printf (" no record \ n "); fclose(fp); return; } printf (" please input you to modify employees gonghaowu: \ n "); The scanf (" % d ", & amp; Snum); For (I=0; i
  • Related