freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

教師信息管理系統(tǒng)c語言課程設(shè)計(jì)(編輯修改稿)

2025-05-05 23:38 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 輸出“還未錄入過教師信息”并退出函數(shù) 調(diào)用教師信息瀏覽函數(shù) 當(dāng)i小于n時(shí) 當(dāng)j小于ni時(shí)p2=p1nextp1=headp2=p2nextp1=p2p3=p1p2=p4p3=p2p1next=p4p2next=p1p4=p2nextp3next=p2head=p2T p1為鏈表頭? F p1中的對(duì)應(yīng)信息小過p2的? T F j=0i=1說明:p1,p2指向的結(jié)點(diǎn)用來比較,p3,p4是用來記錄結(jié)點(diǎn)的,當(dāng)選用的排序方式不同,p1,p2用來比較的信息為所選方式的信息。3. 源程序代碼include include include include define LEN sizeof(struct teacher)//宏定義結(jié)構(gòu)體字節(jié)數(shù)int n=0。struct teacher//定義結(jié)構(gòu)體{ long num。//教師號(hào) char name[20]。//姓名 char sex[5]。//性別 int age。//年齡 char edu[20]。//學(xué)歷 char title[20]。//職稱 long wage。//工資 char addr[100]。//地址 char telep[15]。//電話 struct teacher *next。//指向下一個(gè)結(jié)點(diǎn)}*head=NULL。void key()//口令檢查的函數(shù){ int i。 long a。 for(i=0。i3。i++) { printf(請(qǐng)輸入口令(還可輸入%d次):\n,3i)。 scanf(%ld,amp。a)。 if(a==123456)//檢查口令是否正確 { printf(歡迎進(jìn)入系統(tǒng)\n)。 break。 } else printf(口令錯(cuò)誤\n)。 } if(i==3)//判斷可以輸入口令的次數(shù)是否用完 { printf(可使用的口令輸入次數(shù)已用完,將自動(dòng)退出!\n)。 exit(0)。 }}void save()//把數(shù)據(jù)存入文件的函數(shù){ FILE *fp。 int i。 char filename[20]。 struct teacher *p。 printf(\n 是否把此次登錄系統(tǒng)錄入和修改后的教師信息保存到文件中\(zhòng)n)。 printf( 1:【是】 0:【否】\n請(qǐng)選擇:)。 scanf(%d,amp。i)。 while((i!=0)amp。amp。(i!=1))//判斷輸入的選擇是否有效 { printf(選擇無效,請(qǐng)重新輸入正確選項(xiàng):)。 scanf(%d,amp。i)。 } if(i==1)//判斷是否選擇了要保存 { printf(\n請(qǐng)輸入要保存數(shù)據(jù)的文件名:)。 scanf(%s,filename)。 if((fp=fopen(filename,wb))==NULL) { printf(\n無法打開文件\n)。 exit(0)。 } for(p=head。p!=NULL。p=pnext) if(fwrite(p,sizeof(struct teacher),1,fp)!=1) printf(\n此處數(shù)據(jù)有誤\n)。 fclose(fp)。 } exit(0)。}void read()//從文件讀出數(shù)據(jù)的函數(shù){ struct teacher teach[299],temp。 int i=0。 FILE *fp。 char filename[20]。 printf(\n請(qǐng)輸入存有教師信息的文件名:)。 scanf(%s,filename)。 if((fp=fopen(filename,rb))==NULL) {printf(\n無法打開文件\n)。 exit(0)。 } fseek(fp,sizeof(struct teacher),2)。/*將位置指針從文件末尾后退一個(gè)結(jié)構(gòu)體的字節(jié)數(shù)*/ fread(amp。temp,sizeof(struct teacher),1,fp)。/*從所指向的文件中讀出數(shù)據(jù)存儲(chǔ)到結(jié)構(gòu)體變量temp中*/ fseek(fp,0,0)。//將位置指針移到文件的開頭 if(fread(amp。teach[i],sizeof(struct teacher),1,fp)==1)/*判斷文件開頭讀入的數(shù)據(jù)是否為空*/ { printf(\n存有的教師信息如下:\n)。 while(teach[i].num!=)//進(jìn)行循環(huán)讀取文件 { printf(教師號(hào):%ld,姓名:%s,性別:%s,年齡:%d,學(xué)歷:%s,teach[i].num,teach[i].name,teach[i].sex,teach[i].age,teach[i].edu)。 printf(職稱:%s\n 月薪:%ld,住址:%s,電話:%s\n,teach[i].title,teach[i].wage,teach[i].addr,teach[i].telep)。 i=i+1。 fread(amp。teach[i],sizeof(struct teacher),1,fp)。/*從文件中讀入數(shù)據(jù)存儲(chǔ)到結(jié)構(gòu)體變量teach【i】中*/ }//輸出文件中的最后一個(gè)信息 printf(教師號(hào):%ld,姓名:%s,性別:%s,年齡:%d,學(xué)歷:%s,teach[i].num,teach[i].name,teach[i].sex,teach[i].age,teach[i].edu)。 printf(職稱:%s\n 月薪:%ld,住址:%s,電話:%s\n,teach[i].title,teach[i].wage,teach[i].addr,teach[i].telep)。 fclose(fp)。 } else printf(該文件中無教師信息\n)。//文件為空時(shí)輸出此處}void creat()//錄入教師信息的函數(shù){ struct teacher *p1,*p2,*p3。 p1=p2=(struct teacher *)malloc(LEN)。/*申請(qǐng)一個(gè)結(jié)構(gòu)體字節(jié)數(shù)的空間用來存儲(chǔ)一個(gè)教師的信息*/ printf(請(qǐng)輸入一位教師的教師號(hào)(結(jié)束錄入請(qǐng)輸入0):)。 scanf(%ld,amp。p1num)。 if(p1num!=0)//判斷用戶是要結(jié)束錄入還是要存儲(chǔ)信息 if(head==NULL) head=p1。/*判斷鏈表是否為空,是則將鏈表頭指向p1*/ else //鏈表不為空則將鏈表尾指向p1 { p3=head。//p3用來記錄鏈表的尾部 while(p3next!=NULL)/*若p3不是鏈表尾則將p3指向 下一個(gè)結(jié)點(diǎn)*/ p3=p3next。 p3next=p1。//將最后一個(gè)結(jié)點(diǎn)指向p1 } while(p1num!=0)//判斷用戶是否結(jié)束錄入功能 {//錄入該教師號(hào)的教師對(duì)應(yīng)的信息 printf(姓名: )。 scanf(%s,p1name)。 printf(性別:)。 scanf(%s,p1sex)。 printf(年齡:)。 scanf(%d,amp。p1age)。 printf(學(xué)歷:)。 scanf(%s,p1edu)。 printf(職稱:)。 scanf(%s,p1title)。 printf(月薪:)。 scanf(%ld,amp。p1wage)。 printf(住址:)。 scanf(%s,p1addr)。 printf(電話:)。 scanf(%s,p1telep)。 n=n+1。//給統(tǒng)計(jì)錄入的教師數(shù)n加一/*判斷是否為第一個(gè)錄入的信息,是則將鏈表頭指向p1,否則將p2指向p1*/ if(n==1) head=p1。 else p2next=p1。 p2=p1。//p2用來記錄鏈表的最后一個(gè)結(jié)點(diǎn) p1=(struct teacher *)malloc(LEN)。//重新申請(qǐng)空間 printf(請(qǐng)輸入一位教師的教師號(hào)(結(jié)束錄入請(qǐng)輸入0): )。 scanf(%ld,amp。p1num)。 } p2next=NULL。//將最后一個(gè)結(jié)點(diǎn)指向空}void print()//輸出教師信息的函數(shù){ struct teacher *p。 int i。 p=head。 if(head!=NULL)//判斷鏈表是否為空 { printf(\n這%d位教師的信息
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1