![學(xué)生籍貫信息記錄簿系統(tǒng)課程設(shè)計(jì)源代碼樣本_第1頁(yè)](http://file4.renrendoc.com/view11/M00/03/0F/wKhkGWX6iS6AGN4DAAEFhVc4UQM702.jpg)
![學(xué)生籍貫信息記錄簿系統(tǒng)課程設(shè)計(jì)源代碼樣本_第2頁(yè)](http://file4.renrendoc.com/view11/M00/03/0F/wKhkGWX6iS6AGN4DAAEFhVc4UQM7022.jpg)
![學(xué)生籍貫信息記錄簿系統(tǒng)課程設(shè)計(jì)源代碼樣本_第3頁(yè)](http://file4.renrendoc.com/view11/M00/03/0F/wKhkGWX6iS6AGN4DAAEFhVc4UQM7023.jpg)
![學(xué)生籍貫信息記錄簿系統(tǒng)課程設(shè)計(jì)源代碼樣本_第4頁(yè)](http://file4.renrendoc.com/view11/M00/03/0F/wKhkGWX6iS6AGN4DAAEFhVc4UQM7024.jpg)
![學(xué)生籍貫信息記錄簿系統(tǒng)課程設(shè)計(jì)源代碼樣本_第5頁(yè)](http://file4.renrendoc.com/view11/M00/03/0F/wKhkGWX6iS6AGN4DAAEFhVc4UQM7025.jpg)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
+64編制一種學(xué)生籍貫信息記錄簿,每個(gè)學(xué)生信息涉及:學(xué)號(hào)、姓名、籍貫。詳細(xì)功能:(1)創(chuàng)立信息鏈表并以磁盤文獻(xiàn)保存;(2)讀取磁盤文獻(xiàn)并顯示輸出所有學(xué)生籍貫信息;(3)按學(xué)號(hào)或姓名查詢其籍貫;(4)按籍貫查詢并輸出該籍貫所有學(xué)生;(5)能添加、刪除和修改學(xué)生籍貫信息;#include"dos.h"#include"stdio.h"#include"stdlib.h"#include"conio.h"#include"math.h"#include"string.h"/**********************建立鏈表******************************/structhj{intage;longnumber;charname[10],address[50],sex[2];structhj*next;};/**************************文獻(xiàn)操作函數(shù)******************************/FILE*fp;voidopenfile(charxx[20]){fp=fopen(xx,"ab+");if(fp==NULL)fp=fopen(xx,"wb");}/************************錄入信息函數(shù)***********************************/voidhjnew(void){system("cls");intn=0,xage;longxnumber;charxname[10];charxaddress[50];charxsex[2];structhj*head;structhj*x1,*x2;head=NULL;x2=NULL;printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★錄入信息★★★\n");printf("\n〓提示輸入0返回上級(jí)菜單〓\n\n\n");printf("\n請(qǐng)輸入學(xué)號(hào)【15字內(nèi)】:");scanf("%ld",&xnumber);if(xnumber==0)gotohaha;printf("\n請(qǐng)輸入姓名【10字內(nèi)】:");scanf("%s",xname);printf("\n請(qǐng)輸入年齡【|-__-|】:");scanf("%d",&xage);printf("\n請(qǐng)輸入性別【男OR女】:");scanf("%s",xsex);printf("\n請(qǐng)輸入籍貫【25字內(nèi)】:");scanf("%s",xaddress);while(xnumber!=0){n++;x1=(structhj*)malloc(sizeof(structhj));x1->number=xnumber;strcpy(x1->name,xname);strcpy(x1->sex,xsex);x1->age=xage;strcpy(x1->address,xaddress);if(n==1)head=x1;elsex2->next=x1;x2=x1;printf("\n請(qǐng)輸入學(xué)號(hào)【15字內(nèi)】:");scanf("%ld",&xnumber);if(xnumber==0)break;printf("\n請(qǐng)輸入姓名【10字內(nèi)】:");scanf("%s",xname);printf("\n請(qǐng)輸入年齡【|-__-|】:");scanf("%d",&xage);printf("\n請(qǐng)輸入性別【男OR女】:");scanf("%s",xsex);printf("\n請(qǐng)輸入籍貫【25字內(nèi)】:");scanf("%s",xaddress);}x2->next=NULL;x1=head;while(x1!=NULL){openfile("hj.txt");chard[5]="四川";fwrite(x1,sizeof(structhj),1,fp);fclose(fp);if(strstr(x1->address,d)!=NULL){openfile("schj.txt");fwrite(x1,sizeof(structhj),1,fp);fclose(fp);}else{openfile("qthj.txt");fwrite(x1,sizeof(structhj),1,fp);fclose(fp);}x1=x1->next;}haha:;}/*****************************查詢函數(shù)*************************/voidhjxmselect(void)//按學(xué)號(hào)方式查詢函數(shù){ssmmx:intn=0;longhh;system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★查詢編輯信息★★★\n");printf("\n〓提示輸入0返回上級(jí)菜單〓\n\n\n");printf("請(qǐng)您輸入學(xué)號(hào):");scanf("%ld",&hh);if(hh!=0){structhj*p;structhj*q=NULL,*head=NULL;fp=fopen("hj.txt","rb");if(fp==NULL){printf("\n沒有記錄,請(qǐng)輸入記錄然后再查詢!");getch();gotojjx;}while(!feof(fp)){n++;p=(structhj*)malloc(sizeof(structhj));fread(p,sizeof(structhj),1,fp);if(n==1)head=p;elseq->next=p;q=p;}q->next=NULL;p=head;while(p!=NULL){if(p->number==hh){inta;printf("\n結(jié)果→學(xué)號(hào)=%ld姓名=%s年齡=%d性別=%s",p->number,p->name,p->age,p->sex);printf("\n地址=%s",p->address);printf("\n\n操作→⑴更改數(shù)據(jù)⑵刪除數(shù)據(jù)⑶查詢其她數(shù)據(jù)⑷返回上頁(yè)⑸退出程序\n\n請(qǐng)您選取操作:");ssmx:scanf("%d",&a);switch(a){voidhjedit(structhj*headd,structhj*pp);voidhjdelete(structhj*headdd,structhj*ss);case1:hjedit(head,p);gotossmmx;break;case2:hjdelete(head,p);gotossmmx;break;case3:gotossmmx;case4:gotojjx;case5:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotossmx;}}elsep=p->next;}intiiii=0;printf("\n沒有此記錄1.重新查詢2.返回上一頁(yè)3.退出程序!");printf("\n請(qǐng)選取:");qqqq:scanf("%d",&iiii);switch(iiii){case1:gotossmmx;case2:gotojjx;case3:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotoqqqq;}gotojjx;}jjx:;}voidhjxhselect(void)//按姓名方式查詢函數(shù){ssmm:intn=0;charhh[10];system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★查詢編輯信息★★★\n");printf("\n〓提示輸入0返回上級(jí)菜單〓\n\n\n");printf("請(qǐng)您輸入姓名:");scanf("%s",hh);if(strcmp(hh,"0")!=0){structhj*p;structhj*q=NULL,*head=NULL;fp=fopen("hj.txt","rb");if(fp==NULL){printf("\n沒有記錄,請(qǐng)輸入記錄然后再查詢!");getch();gotojjj;}while(!feof(fp)){n++;p=(structhj*)malloc(sizeof(structhj));fread(p,sizeof(structhj),1,fp);if(n==1)head=p;elseq->next=p;q=p;}q->next=NULL;p=head;while(p!=NULL){if(strcmp(p->name,hh)==0){inta;printf("\n結(jié)果→學(xué)號(hào)=%ld姓名=%s年齡=%d性別=%s",p->number,p->name,p->age,p->sex);printf("\n地址=%s",p->address);printf("\n\n操作→⑴更改數(shù)據(jù)⑵刪除數(shù)據(jù)⑶查詢其她數(shù)據(jù)⑷返回上頁(yè)⑸退出程序\n\n請(qǐng)您選取操作:");ssm:scanf("%d",&a);switch(a){voidhjedit(structhj*headd,structhj*pp);voidhjdelete(structhj*headdd,structhj*ss);case1:hjedit(head,p);gotossmm;break;case2:hjdelete(head,p);gotossmm;break;case3:gotossmm;case4:gotojjj;case5:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotossm;}}elsep=p->next;}intiii=0;printf("\n沒有此記錄1.重新查詢2.返回上一頁(yè)3.退出程序!");printf("\n請(qǐng)選取:");qqq:scanf("%d",&iii);switch(iii){case1:gotossmm;case2:gotojjj;case3:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotoqqq;}gotojjj;}jjj:;}voidhjjgselect(void)//按籍貫方式查詢{yyy:inti;system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★籍貫方式查詢信息★★★\n\n\n");printf("\n一顯示所有信息\n");printf("\n二顯示四川籍所有信息\n");printf("\n三顯示其他籍所有信息\n");printf("\n四自定義查詢信息\n");printf("\n五←返回上級(jí)菜單\n");printf("\n六↓退出程序\n");printf("\n\n請(qǐng)選?。?);scanf("%d",&i);switch(i){voidzdyselect(void);voidallselect(chara[8]);case1:allselect("hj.txt");gotoyyy;break;case2:allselect("schj.txt");gotoyyy;break;case3:allselect("qthj.txt");gotoyyy;break;case4:zdyselect();case5:break;case6:exit(0);}}voidzdyselect(void){ssmmz:intn=0,j=0;charhh[10];system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★自定義查詢信息★★★\n\n\n");printf("請(qǐng)您輸入地址核心字:");scanf("%s",hh);if(strcmp(hh,"0")!=0){structhj*p;structhj*q=NULL,*head=NULL;fp=fopen("hj.txt","rb");if(fp==NULL){printf("\n沒有記錄,請(qǐng)輸入記錄然后再查詢!");getch();gotojjz;}while(!feof(fp)){n++;p=(structhj*)malloc(sizeof(structhj));fread(p,sizeof(structhj),1,fp);if(n==1)head=p;elseq->next=p;q=p;}q->next=NULL;p=head;while(p!=NULL){if(strstr(p->address,hh)!=NULL){inta;j++;printf("\n結(jié)果→學(xué)號(hào)=%ld姓名=%s年齡=%d性別=%s",p->number,p->name,p->age,p->sex);printf("\n地址=%s",p->address);printf("\n\n操作→⑴更改數(shù)據(jù)⑵刪除數(shù)據(jù)⑶查詢下一條數(shù)據(jù)⑷返回上頁(yè)⑸退出程序\n\n請(qǐng)您選取操作:");ssmz:scanf("%d",&a);switch(a){voidhjedit(structhj*headd,structhj*pp);voidhjdelete(structhj*headdd,structhj*ss);case1:hjedit(head,p);gotossmmz;break;case2:hjdelete(head,p);gotossmmz;break;case3:p=p->next;continue;case4:gotojjz;case5:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotossmz;}p=p->next;}elsep=p->next;}if(j==0){printf("\n\n\n沒有匹配記錄按任意鍵繼續(xù)!");getch();fclose(fp);gotossmmz;}else{intxx;printf("\n\n查詢完畢?、爬^續(xù)查詢⑵返回上一級(jí)菜單⑶退出程序");printf("\n請(qǐng)選取:");scanf("%d",&xx);if(xx==2)gotojjz;elseif(xx==3)exit(0);}gotossmmz;jjz:;}}voidallselect(chara[8])//所有查詢{intn=0;intk=0;system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★籍貫方式信息★★★\n\n\n");structhj*p;structhj*q=NULL,*head=NULL;fp=fopen(a,"rb");if(fp==NULL){printf("\n對(duì)不起,沒有記錄無法查詢!");gotoxxxx;}rewind(fp);while(!feof(fp)){n++;p=(structhj*)malloc(sizeof(structhj));fread(p,sizeof(structhj),1,fp);if(n==1)head=p;elseq->next=p;q=p;}q->next=NULL;structhj*h1,*p2,*q3,*r4,*s5;h1=p2=(hj*)malloc(sizeof(structhj));p2->next=head;while(p2->next!=NULL){q3=p2->next;r4=p2;while(q3->next!=NULL){if(q3->next->number<p2->next->number)r4=q3;q3=q3->next;}if(r4!=p2){s5=r4->next;r4->next=s5->next;s5->next=p2->next;p2->next=s5;}p2=p2->next;}head=h1->next->next;free(h1);p=head;while(p!=NULL&&n>0){n--;printf("\n學(xué)號(hào)=%ld姓名=%s年齡=%d性別=%s",p->number,p->name,p->age,p->sex);printf("\n地址=%s",p->address);p=p->next;}xxxx:printf("\n→顯示完畢←\n⑴↑返回上級(jí)菜單⑵↓退出程序\n請(qǐng)選擇:");xxx:scanf("%d",&n);switch(n){case1:break;case2:exit(0);default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotoxxx;}}voidhjselect(void)//查詢編輯信息函數(shù){cxbegin:inta;system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★查詢編輯信息★★★\n\n\n");printf("\n一按學(xué)號(hào)方式查詢\n");printf("\n二按姓名方式查詢\n");printf("\n三按籍貫方式查詢\n");printf("\n四→顯示所有信息\n");printf("\n五←返回上級(jí)菜單\n");printf("\n請(qǐng)選擇查詢方式:");cxmm:scanf("%d",&a);switch(a){case1:hjxmselect();gotocxbegin;break;case2:hjxhselect();gotocxbegin;break;case3:hjjgselect();gotocxbegin;break;case4:allselect("hj.txt");gotocxbegin;break;case5:break;default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotocxmm;}}voidhjde(void)//刪除界面函數(shù){cxxbegin:inta;system("cls");printf("\n★★★★★歡迎使顧客籍管理系統(tǒng)★★★★★\n");printf("\n★★★刪除信息★★★\n\n\n");printf("\n一按學(xué)號(hào)方式刪除\n");printf("\n二按姓名方式刪除\n");printf("\n三按籍貫方式刪除\n");printf("\n四→刪除所有信息\n");printf("\n五←返回上級(jí)菜單\n");printf("\n請(qǐng)選擇刪除方式:");cxxmm:scanf("%d",&a);inti=0;switch(a){case1:hjxmselect();gotocxxbegin;break;case2:hjxhselect();gotocxxbegin;break;case3:zdyselect();gotocxxbegin;break;case4:fp=fopen("hj.txt","wb");if(fp!=NULL)i++;fp=fopen("schj.txt","wb");if(fp!=NULL)i++;fp=fopen("qthj.txt","wb");if(fp!=NULL)i++;if(i==3){printf("\n所有數(shù)據(jù)已經(jīng)刪除!!!!!!敲任意鍵繼續(xù)");getch();}gotocxxbegin;break;case5:break;default:printf("\n錯(cuò)誤選取,請(qǐng)重新選?。?);gotocxxmm;}}//==============刪除函數(shù)接口===============voidhjdelete(structhj*headdd,structhj*ss){structhj*q;chard[5]="四川";if(headdd==ss){headdd=headdd->next;gotogogo;}q=headdd;while(q!=NULL){if(q->next->number==ss->number){break;}q=q->next;}q->next=ss->next;gogo:q=headdd;fp=fopen("hj.txt","wb");while(q!=NULL){fwrite(q,sizeof(structhj),1,fp);q=q->next;}fclose(fp);q=headdd;fp=fopen("schj.txt","wb");while(q!=NULL){if(strstr(q->address,d)!=NULL){fwrite(q,sizeof(structhj),1,fp);}q=q->next;}fclose(fp);q=headdd;fp=fopen("qthj.txt","wb");while(q!=NULL){if(strstr(q->address,d)==NULL){fwrite(q,sizeof(structhj),1,fp);}q=q->next;}fclose(fp);}//===============編輯函數(shù)接口==============voidhjedit(structhj*headd,structhj*pp){intn=0;structhj*p,*p1,*p2;chard[5]="四川";printf("\n輸入→學(xué)號(hào)=");scanf("%l
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 專利代理居間合同樣本
- 物業(yè)管理委托合同
- 家庭室內(nèi)外裝修合同書
- 多模式跨境電子商務(wù)解決方案策劃與設(shè)計(jì)全案指南
- 研發(fā)項(xiàng)目管理作業(yè)指導(dǎo)書
- 生物技術(shù)與實(shí)驗(yàn)室技能作業(yè)指導(dǎo)書
- 電線電纜購(gòu)銷合同
- 2025年天津年貨運(yùn)從業(yè)資格證考試從業(yè)從業(yè)資格資格題庫(kù)及答案
- 2025年烏魯木齊貨運(yùn)從業(yè)資格考試題目大全
- 小學(xué)青島版一年級(jí)數(shù)學(xué)上冊(cè)口算練習(xí)題總匯
- 《配電網(wǎng)設(shè)施可靠性評(píng)價(jià)指標(biāo)導(dǎo)則》
- 2024年國(guó)家電網(wǎng)招聘之通信類題庫(kù)附參考答案(考試直接用)
- ## 外事領(lǐng)域意識(shí)形態(tài)工作預(yù)案
- CJJ 169-2012城鎮(zhèn)道路路面設(shè)計(jì)規(guī)范
- 第八單元金屬和金屬材料單元復(fù)習(xí)題-2023-2024學(xué)年九年級(jí)化學(xué)人教版下冊(cè)
- 鋼鐵是怎樣煉成的保爾成長(zhǎng)史
- 精神科護(hù)理技能5.3出走行為的防范與護(hù)理
- 煤礦機(jī)電運(yùn)輸培訓(xùn)課件
- 采購(gòu)管理學(xué)教學(xué)課件
- 《供應(yīng)商質(zhì)量會(huì)議》課件
- 江蘇省科技企業(yè)孵化器孵化能力評(píng)價(jià)研究的中期報(bào)告
評(píng)論
0/150
提交評(píng)論