資源描述:
《高校教師人事管理系統(tǒng)2》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在工程資料-天天文庫。
1、#incIude#include#include#defineLENsizeof(structteacher)struetteacher(longnum;charname[10];charsex[5];charcsrq[10];chargzsj[20];intgz;charxy[20];charzc[20];charxw[20];structteacher*next;};intn;structteacher*sum(structteacher*head);structteacher*creat(void);struet
2、teacher*assign(struetteacher*head);voidadd();voiddel();voidmodify();voidsearch();voidstatis();intma.in(){structteacher*p=NULL;intm;while(1){printf(〃統(tǒng)**********");printf("****〃);printf("****");printf(z,****");printf(〃****〃);printf(〃****〃);printf("************髙校教師人事管理系創(chuàng)建,請按1追加
3、,請按2刪除,請按3修改,請按4查詢,請按5統(tǒng)計,請按6**〃);scanf(〃%d",&m);if(m>=0&&m<=6){switch(m){case1:p=creat();break;case2:add();break;case3:del();break;case4:modify();break;case5:search();break;/*case6:statis();break;*/case0:exit(0);}printfCz操作完成,再次輸入〃);}elsereturn(0);}〃主函structteacher*creat(void){FILE*fp;str
4、uctteacher*head,*pl,*p2;head=pl=(structteacher*)malloc(LEM);n=0;printf(〃請輸入編號〃);scanf(/z%ldz,,&pl->num);printf("請輸入姓名〃);scanf(〃%s〃,pl->name);printfC請輸入性別〃);seanf(〃%s〃,pl->sex);printf(,z請輸入出生日期〃);scanf(〃%s〃,pl->csrq);printf(z/請輸入?yún)⒓庸ぷ鲿r間〃);scanf(〃%s〃,&pl->gzsj);printf(〃請輸
5、入工資〃);scanf(〃%d:&pl->gz);scanf(〃%s〃,&pl->xy);printfCAn請輸入職稱(助教、講師、副教授、教授)『);scanf(〃%s〃,pl~>zc);printf(zz請輸入學位(學士、碩士、博士)〃);seanf("%s〃,pl->xw);while(pl->num!=O){n++;if(n==l)p2二pl;else{p2->next二pl;p2=pl;)pl=(structteacher*)malloc(LEN);printf(〃請輸入編號〃);scanf&pl->num);if(pl->num==0)bre
6、ak;printf(zz請輸入姓名〃);scanf("%s",pl~>name);printf(/z請輸入性別〃);seanf(〃%s〃,pl->scx);scanf("%s〃,pl->csrq);printf(〃請輸入?yún)⒓庸ぷ鲿r間〃);seanf(〃%s〃,&pl->gzsj);printf(〃請輸入工資〃);scanf("%d",&pl->gz);printf("請輸入學院〃);scanf(〃%s〃,&pl~>xy);printf(〃請輸入職稱(助教、講師、副教授、教授)〃);scanf("%s",pl~>zc);print
7、fC請輸入學位(學士、碩士、博士)『);scanf("%s〃,pl->xw);}p2-〉next二NULL;head=assign(head);fp=fopen(〃teacher?txt",〃wb〃);pl二head;wh訂e(pl!二NULL)fwrite(pl,LEN,1,fp);pl=pl->ncxt;free(pl);fclose(fp);return(head);}//建立鏈表,排序,寫入文件structteacher*assign(structteacher*head){structt