版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、 PAGE35 / NUMPAGES35程序設(shè)計課程設(shè)計報告課題名稱: 學(xué)生籍貫信息記錄簿專業(yè) 計算機科學(xué)與技術(shù)(軟件工程)學(xué)生班級學(xué)號指導(dǎo)教師完成日期一 課程設(shè)計的目的1二 設(shè)計容與要求1三 主要技術(shù)指標(biāo)與特點13.0 信息描述(注:用流程圖表示)13.1 創(chuàng)建信息鏈表并以磁盤文件保存;23.2 讀取磁盤文件并顯示輸出所有學(xué)生的籍貫信息;33.3 按學(xué)號或查詢其籍貫;53.4 按籍貫查詢并輸出該籍貫的所有學(xué)生;93.5 能添加、刪除和修改學(xué)生的籍貫信息;113.6 顯示輸出籍和非籍學(xué)生的信息并可分別存盤。16四 設(shè)計小結(jié)17五 程序源代碼18六 參考文獻29課程設(shè)計的目的加深對C語言程序設(shè)計
2、課程知識的理解,掌握C語言應(yīng)用程序的開發(fā)方法和步驟; 進一步掌握和利用C語言進行課程設(shè)計的能力;進一步理解和運用結(jié)構(gòu)化程序設(shè)計的思想和方法;初步掌握開發(fā)一個小型實用系統(tǒng)的基本方法;學(xué)會調(diào)試一個較長的程序的基本方法;學(xué)會利用流程圖或N-S圖表示算法;掌握書寫課程設(shè)計開發(fā)文檔的能力(書寫課程報告)。二設(shè)計容與要求 編制一個學(xué)生籍貫信息記錄簿,每個學(xué)生信息包括:學(xué)號、籍貫。具體功能要求如下: 1創(chuàng)建信息鏈表并以磁盤文件保存;2讀取磁盤文件并顯示輸出所有學(xué)生的籍貫信息;3按學(xué)號或查詢其籍貫;4按籍貫查詢并輸出該籍貫的所有學(xué)生;5能添加、刪除和修改學(xué)生的籍貫信息;6顯示輸出籍和非籍學(xué)生的信息并可分別存盤
3、。三.主要技術(shù)指標(biāo)與特點3.0 信息描述 (注:用流程圖表示)籍貫信息記錄簿建立鏈表錄入信息顯示信息查詢信息編輯信息分類管理主函數(shù)添加信息刪除信息修改信息3.1 創(chuàng)建信息鏈表并以磁盤文件保存;/*建立鏈表*/struct hj long number; char name10,address50; struct hj *next;/*文件操作函數(shù)*/FILE *fp;void openfile(char xx20) fp=fopen(xx,ab+); if(fp=NULL) fp=fopen(xx,wb);/*主函數(shù)*/int main(int argc, char* argv) begin:
4、 int t; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)nnnnn); printf( 一 錄入學(xué)生籍貫信息nn); printf( 二 查編學(xué)生籍貫信息nn); printf( 三 刪除學(xué)生籍貫信息nn); printf( 四 退出程序nn); printf( 請您選擇:);mm: scanf(%d,&t); switch(t) case 1: hjnew();break; case 2: hjselect();break; case 3: hjde();break; case 4:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); go
5、to mm; goto begin; return 0; 讀取磁盤文件并顯示輸出所有學(xué)生的籍貫信息;void allselect(char a8)/全部查詢 int n=0;int k=0; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 籍貫方式信息nnn); struct hj *p;struct hj *q=NULL,*head=NULL; fp=fopen(a,rb); if(fp=NULL) printf(n對不起,沒有記錄無法查詢!); goto xxxx; rewind(fp); while(!feof(fp) n+; p=(struct
6、 hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p;q-next=NULL; struct hj *h1,*p2,*q3,*r4,*s5; h1=p2=(hj *)malloc(sizeof(struct hj); p2-next=head; while(p2-next!=NULL) q3=p2-next; r4=p2; while(q3-next!=NULL) if(q3-next-numbernext-number) r4=q3; q3=q3-
7、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&n0) n-; printf(n學(xué)號=%ld =%s,p-number,p-name); printf(n地址=%s,p-address); p=p-next; xxxx: printf(n顯示完畢n返回上級菜單退出程序n請 選 擇 :);xxx: scanf(%d,&n); switch(n) case 1:break;
8、 case 2:exit(0); default:printf(n錯誤的選擇,請重新選擇:); goto xxx; void hjselect(void)/查詢編輯信息函數(shù) cxbegin: int a; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 查詢編輯信息nnn); printf(n 一 按學(xué)號方式查詢n); printf(n 二 按方式查詢n); printf(n 三 按籍貫方式查詢n); printf(n 四 顯示全部信息n); printf(n 五 返回上級菜單n); printf(n 請 選 擇 查 詢 方 式:);cxmm: sca
9、nf(%d,&a); switch(a) case 1: hjxmselect();goto cxbegin;break; case 2: hjxhselect();goto cxbegin;break; case 3: hjjgselect();goto cxbegin;break; case 4: allselect(hj.txt);goto cxbegin;break; case 5: break; default:printf(n錯誤的選擇,請重新選擇:); goto cxmm; 3.3 按學(xué)號或查詢其籍貫;/*查詢函數(shù)*/void hjxmselect(void) /按學(xué)號方式查詢函
10、數(shù)ssmmx: int n=0; long hh; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 查詢編輯信息n); printf(n 提示輸入0返回上級菜單nnn); printf( 請您輸入學(xué)號:); scanf(%ld,&hh); if(hh!=0) struct hj *p; struct hj *q=NULL,*head=NULL; fp=fopen(hj.txt,rb); if(fp=NULL) printf(n沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjx; while(!feof(fp) n+; p=(str
11、uct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(p-number=hh) int a; printf(n 結(jié) 果 學(xué)號=%ld =%s,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢其他數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssmx: scanf(%d,&
12、a); switch(a) void hjedit(struct hj *headd,struct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmmx;break; case 2: hjdelete(head,p); goto ssmmx;break; case 3: goto ssmmx; case 4: goto jjx; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssmx; else p=p-n
13、ext; int iiii=0; printf(n 沒有此記錄 1.重新查詢 2.返回上一頁 3.退出程序!); printf(n 請選擇:); : scanf(%d,&iiii); switch(iiii) case 1: goto ssmmx; case 2: goto jjx; case 3: exit(0); default: printf(n 錯誤的選擇,請重新選擇:); goto ; goto jjx; jjx:;void hjxhselect(void)/按方式查詢函數(shù)ssmm: int n=0; char hh10; system(cls); printf(n 歡迎使用戶籍管理
14、系統(tǒng)n); printf(n 查詢編輯信息n); printf(n 提示輸入0返回上級菜單nnn); printf( 請您輸入:); scanf(%s,hh); if(strcmp(hh,0)!=0) struct hj *p; struct hj *q=NULL,*head=NULL; fp=fopen(hj.txt,rb); if(fp=NULL) printf(n沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjj; while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(
15、struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(strcmp(p-name,hh)=0) int a; printf(n 結(jié) 果 學(xué)號=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢其他數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssm: scanf(%d,&a); switch(a) void hjedit(struct hj *headd
16、,struct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmm;break; case 2: hjdelete(head,p); goto ssmm;break; case 3: goto ssmm; case 4: goto jjj; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssm; else p=p-next; int iii=0; printf(n 沒有此記錄 1.重新查詢 2.返回上一頁
17、3.退出程序!); printf(n 請選擇:); q: scanf(%d,&iii); switch(iii) case 1: goto ssmm; case 2: goto jjj; case 3: exit(0); default: printf(n 錯誤的選擇,請重新選擇:); goto q; goto jjj; jjj: ;3.4 按籍貫查詢并輸出該籍貫的所有學(xué)生;void hjjgselect(void)/按籍貫方式查詢yyy: int i; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 籍貫方式查詢信息nnn); printf(n 一
18、顯示所有信息n); printf(n 二 顯示籍所有信息n); printf(n 三 顯示其它籍所有信息n); printf(n 四 自定義查詢信息n); printf(n 五 返回上級菜單n); printf(n 六 退出程序n); printf(nn 請選擇:); scanf(%d,&i); switch(i) void zdyselect(void); void allselect(char a8); case 1:allselect(hj.txt); goto yyy;break; case 2: allselect(schj.txt); goto yyy;break; case 3:
19、 allselect(qthj.txt); goto yyy;break; case 4: zdyselect(); case 5: break; case 6: exit(0); void zdyselect(void) ssmmz: int n=0,j=0; char hh10; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 自定義查詢信息nnn); printf( 請您輸入地址關(guān)鍵字:); scanf(%s,hh); if(strcmp(hh,0)!=0) struct hj *p; struct hj *q=NULL,*head=NULL;
20、fp=fopen(hj.txt,rb); if(fp=NULL) printf(n 沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjz; while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(strstr(p-address,hh)!=NULL) int a; j+; printf(n 結(jié) 果
21、 學(xué)號=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢下一條數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssmz: scanf(%d,&a); switch(a) void hjedit(struct hj *headd,struct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmmz;break; case 2: hjdelete(head,p)
22、; goto ssmmz;break; case 3: p=p-next;continue; case 4: goto jjz; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssmz; p=p-next; else p=p-next; if(j=0) printf(nnn沒有匹配的記錄 按任意鍵繼續(xù)!); getch(); fclose(fp); goto ssmmz; else int xx; printf(nn查詢完畢! 繼續(xù)查詢 返回上一級菜單 退出程序); printf(n請選擇:); scanf(%d,&xx); if(x
23、x=2) goto jjz; else if(xx=3) exit(0); goto ssmmz;jjz: ; 能添加、刪除和修改學(xué)生的籍貫信息;/*錄入信息函數(shù)*/void hjnew(void) system(cls); int n=0; long xnumber; char xname10; char xaddress50; struct hj *head; struct hj *x1,*x2; head=NULL; x2=NULL; printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 錄入信息n); printf(n 提示輸入0返回上級菜單nnn); printf(n 請輸
24、入學(xué)號15字:); scanf(%ld,&xnumber); if(xnumber=0) goto haha; printf(n 請輸入10字:); scanf(%s,xname); printf(n 請輸入籍貫25字:); scanf(%s,xaddress); while(xnumber!=0) n+; x1=(struct hj *)malloc(sizeof(struct hj); x1-number=xnumber; strcpy(x1-name,xname); strcpy(x1-address,xaddress); if(n=1) head=x1; else x2-next=x1
25、; x2=x1; printf(n 請輸入學(xué)號15字:); scanf(%ld,&xnumber); if(xnumber=0) break; printf(n 請輸入10字:); scanf(%s,xname); printf(n 請輸入籍貫25字:); scanf(%s,xaddress); x2-next=NULL; x1=head; while(x1!=NULL) openfile(hj.txt); char d5=; fwrite(x1,sizeof(struct hj),1,fp); fclose(fp); if(strstr(x1-address,d)!=NULL) openfi
26、le(schj.txt); fwrite(x1,sizeof(struct hj),1,fp); fclose(fp); else openfile(qthj.txt); fwrite(x1,sizeof(struct hj),1,fp); fclose(fp); x1=x1-next; haha:;void hjde(void)/刪除界面函數(shù)cxxbegin: int a; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 刪除信息nnn); printf(n 一 按學(xué)號方式刪除n); printf(n 二 按方式刪除n); printf(n 三 按籍
27、貫方式刪除n); printf(n 四 刪除全部信息n); printf(n 五 返回上級菜單n); printf(n 請 選 擇 刪 除 方 式:);cxxmm: scanf(%d,&a); int i=0; switch(a) case 1: hjxmselect();goto cxxbegin;break; case 2: hjxhselect();goto cxxbegin;break; case 3: zdyselect();goto cxxbegin;break; case 4: fp=fopen(hj.txt,wb); if(fp!=NULL) i+; fp=fopen(schj
28、.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(); goto cxxbegin;break; case 5: break; default:printf(n錯誤的選擇,請重新選擇:); goto cxxmm; /=刪除函數(shù)接口=void hjdelete(struct hj *headdd,struct hj *ss) struct hj *q; char d5=; if(headdd=ss) headdd=headdd-ne
29、xt; goto gogo; 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(struct hj),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,sizeo
30、f(struct hj),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(struct hj),1,fp); q=q-next; fclose(fp);/=編輯函數(shù)接口=void hjedit(struct hj *headd,struct hj *pp) int n=0; struct hj *p,*p1,*p2; char d5=; printf(n 輸 入 學(xué)號=); scanf(%ld,&pp
31、-number); printf(n =); scanf(%s,pp-name); printf(n 地址=); scanf(%s,pp-address); p=headd; fp=fopen(hj.txt,wb); while(p!=NULL) fwrite(p,sizeof(struct hj),1,fp); p=p-next; fclose(fp); p1=headd; fp=fopen(schj.txt,wb); while(p1!=NULL) if(strstr(p1-address,d)!=NULL) fwrite(p1,sizeof(struct hj),1,fp); p1=p1
32、-next; fclose(fp); p2=headd; fp=fopen(qthj.txt,wb); while(p2!=NULL) if(strstr(p2-address,d)=NULL) fwrite(p2,sizeof(struct hj),1,fp); p2=p2-next; fclose(fp);3.6 顯示輸出籍和非籍學(xué)生的信息并可分別存盤。 void hjjgselect(void)/按籍貫方式查詢yyy: int i; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 籍貫方式查詢信息nnn); printf(n 一 顯示所有信息n)
33、; printf(n 二 顯示籍所有信息n); printf(n 三 顯示其它籍所有信息n); printf(n 四 自定義查詢信息n); printf(n 五 返回上級菜單n); printf(n 六 退出程序n); printf(nn 請選擇:); scanf(%d,&i); switch(i) void zdyselect(void); void allselect(char a8); case 1:allselect(hj.txt); goto yyy;break; case 2: allselect(schj.txt); goto yyy;break; case 3: allsele
34、ct(qthj.txt); goto yyy;break; case 4: zdyselect(); case 5: break; case 6: exit(0); 四設(shè)計小結(jié)課程設(shè)計是培養(yǎng)學(xué)生綜合運用所學(xué)知識、發(fā)現(xiàn)、提出、分析和解決實際問題,鍛煉實踐能力的重要環(huán)節(jié),是對學(xué)生實際工作能力的具體訓(xùn)練和考察過程。隨著科學(xué)技術(shù)的發(fā)展,當(dāng)今計算機存活在世界的每一個角落。因此,作為二十一世紀(jì)的大學(xué)生來說,掌握計算機開發(fā)技術(shù)是非常正要的。對于此次課程設(shè)計,感慨頗多。的確,從拿到題目到完成整個編程,從理論到實踐,在兩周時間里,可以學(xué)到很多很多的東西,同時不僅可以鞏固以前所學(xué)過的知識,還學(xué)到了許多書本上沒有的
35、知識。通過這次課程設(shè)計,我懂得了理論與實踐相結(jié)合是很重要的,只有理論知識是遠(yuǎn)遠(yuǎn)不夠的,只有把所學(xué)的理論知識和實踐相結(jié)合起來,從理論中得出結(jié)論,才能真正的提高自己的實際動手能力和獨立思考的能力,才能真正的為社會服務(wù)。在設(shè)計過程中,可以說是困難重重,畢竟很久沒有接觸過C語言了,很多基礎(chǔ)知識都忘記了,難免會遇到各種各樣的問題,比如scanf每加&或缺少之類的小錯誤都要花很長時間找出來,另外對文件的讀寫等操作以前一直不大清楚,這次課程設(shè)計中包含了許多對文件的操作,使我對文件操作的能力有了很大的提高。正所謂:溫故而知新!兩周的課程設(shè)計結(jié)束了,期間遇到了很多問題,這次設(shè)計在老師和同學(xué)的指導(dǎo)與幫助下、查閱資
36、料以與借鑒網(wǎng)上原有的同類程序代碼得以完成。 我也意識到自己掌握的知識還很缺陷,在以后的課程學(xué)習(xí)中,我要更加認(rèn)真仔細(xì),全面地了解相關(guān)知識。五.程序代碼#include dos.h#include stdio.h#include stdlib.h#include conio.h#include math.h#include string.h /*建立鏈表*/struct hj long number; char name10,address50; struct hj *next;/*文件操作函數(shù)*/FILE *fp;void openfile(char xx20) fp=fopen(xx,ab+)
37、; if(fp=NULL) fp=fopen(xx,wb);/*錄入信息函數(shù)*/void hjnew(void) system(cls); int n=0; long xnumber; char xname10; char xaddress50; struct hj *head; struct hj *x1,*x2; head=NULL; x2=NULL; printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 錄入信息n); printf(n 提示輸入0返回上級菜單nnn); printf(n 請輸入學(xué)號15字:); scanf(%ld,&xnumber); if(xnumber=0
38、) goto haha; printf(n 請輸入10字:); scanf(%s,xname); printf(n 請輸入籍貫25字:); scanf(%s,xaddress); while(xnumber!=0) n+; x1=(struct hj *)malloc(sizeof(struct hj); x1-number=xnumber; strcpy(x1-name,xname); strcpy(x1-address,xaddress); if(n=1) head=x1; else x2-next=x1; x2=x1; printf(n 請輸入學(xué)號15字:); scanf(%ld,&xn
39、umber); if(xnumber=0) break; printf(n 請輸入10字:); scanf(%s,xname); printf(n 請輸入籍貫25字:); scanf(%s,xaddress); x2-next=NULL; x1=head; while(x1!=NULL) openfile(hj.txt); char d5=; fwrite(x1,sizeof(struct hj),1,fp); fclose(fp); if(strstr(x1-address,d)!=NULL) openfile(schj.txt); fwrite(x1,sizeof(struct hj),1
40、,fp); fclose(fp); else openfile(qthj.txt); fwrite(x1,sizeof(struct hj),1,fp); fclose(fp); x1=x1-next; haha:;/*查詢函數(shù)*/void hjxmselect(void) /按學(xué)號方式查詢函數(shù)ssmmx: int n=0; long hh; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 查詢編輯信息n); printf(n 提示輸入0返回上級菜單nnn); printf( 請您輸入學(xué)號:); scanf(%ld,&hh); if(hh!=0) st
41、ruct hj *p; struct hj *q=NULL,*head=NULL; fp=fopen(hj.txt,rb); if(fp=NULL) printf(n沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjx; while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(p-number=h
42、h) int a; printf(n 結(jié) 果 學(xué)號=%ld =%s,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢其他數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssmx: scanf(%d,&a); switch(a) void hjedit(struct hj *headd,struct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmmx;break; case
43、 2: hjdelete(head,p); goto ssmmx;break; case 3: goto ssmmx; case 4: goto jjx; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssmx; else p=p-next; int iiii=0; printf(n 沒有此記錄 1.重新查詢 2.返回上一頁 3.退出程序!); printf(n 請選擇:); : scanf(%d,&iiii); switch(iiii) case 1: goto ssmmx; case 2: goto jjx; case 3: ex
44、it(0); default: printf(n 錯誤的選擇,請重新選擇:); goto ; goto jjx; jjx:;void hjxhselect(void)/按方式查詢函數(shù)ssmm: int n=0; char hh10; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 查詢編輯信息n); printf(n 提示輸入0返回上級菜單nnn); printf( 請您輸入:); scanf(%s,hh); if(strcmp(hh,0)!=0) struct hj *p; struct hj *q=NULL,*head=NULL; fp=fopen
45、(hj.txt,rb); if(fp=NULL) printf(n沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjj; while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(strcmp(p-name,hh)=0) int a; printf(n 結(jié) 果 學(xué)號=%ld =%s ,p-numbe
46、r,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢其他數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssm: scanf(%d,&a); switch(a) void hjedit(struct hj *headd,struct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmm;break; case 2: hjdelete(head,p); goto ssmm;break; case
47、 3: goto ssmm; case 4: goto jjj; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssm; else p=p-next; int iii=0; printf(n 沒有此記錄 1.重新查詢 2.返回上一頁 3.退出程序!); printf(n 請選擇:); q: scanf(%d,&iii); switch(iii) case 1: goto ssmm; case 2: goto jjj; case 3: exit(0); default: printf(n 錯誤的選擇,請重新選擇:); goto q; g
48、oto jjj; jjj: ;void hjjgselect(void)/按籍貫方式查詢yyy: int i; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 籍貫方式查詢信息nnn); printf(n 一 顯示所有信息n); printf(n 二 顯示籍所有信息n); printf(n 三 顯示其它籍所有信息n); printf(n 四 自定義查詢信息n); printf(n 五 返回上級菜單n); printf(n 六 退出程序n); printf(nn 請選擇:); scanf(%d,&i); switch(i) void zdyselect(
49、void); void allselect(char a8); case 1:allselect(hj.txt); goto yyy;break; case 2: allselect(schj.txt); goto yyy;break; case 3: allselect(qthj.txt); goto yyy;break; case 4: zdyselect(); case 5: break; case 6: exit(0); void zdyselect(void) ssmmz: int n=0,j=0; char hh10; system(cls); printf(n 歡迎使用戶籍管理系
50、統(tǒng)n); printf(n 自定義查詢信息nnn); printf( 請您輸入地址關(guān)鍵字:); scanf(%s,hh); if(strcmp(hh,0)!=0) struct hj *p; struct hj *q=NULL,*head=NULL; fp=fopen(hj.txt,rb); if(fp=NULL) printf(n 沒有記錄,請輸入記錄然后再查詢!); getch(); goto jjz; while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp);
51、if(n=1) head=p; else q-next=p; q=p; q-next=NULL; p=head; while(p!=NULL) if(strstr(p-address,hh)!=NULL) int a; j+; printf(n 結(jié) 果 學(xué)號=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改數(shù)據(jù) 刪除數(shù)據(jù) 查詢下一條數(shù)據(jù) 返回上頁 退出程序nn 請您選擇操作:);ssmz: scanf(%d,&a); switch(a) void hjedit(struct hj *headd,stru
52、ct hj *pp); void hjdelete(struct hj *headdd,struct hj *ss); case 1: hjedit(head,p); goto ssmmz;break; case 2: hjdelete(head,p); goto ssmmz;break; case 3: p=p-next;continue; case 4: goto jjz; case 5:exit(0); default:printf(n 錯誤的選擇,請重新選擇:); goto ssmz; p=p-next; else p=p-next; if(j=0) printf(nnn沒有匹配的記錄
53、 按任意鍵繼續(xù)!); getch(); fclose(fp); goto ssmmz; else int xx; printf(nn查詢完畢! 繼續(xù)查詢 返回上一級菜單 退出程序); printf(n請選擇:); scanf(%d,&xx); if(xx=2) goto jjz; else if(xx=3) exit(0); goto ssmmz;jjz: ; void allselect(char a8)/全部查詢 int n=0; int k=0; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 籍貫方式信息nnn); struct hj *p;
54、struct hj *q=NULL,*head=NULL; fp=fopen(a,rb); if(fp=NULL) printf(n對不起,沒有記錄無法查詢!); goto xxxx; rewind(fp); while(!feof(fp) n+; p=(struct hj *)malloc(sizeof(struct hj); fread(p,sizeof(struct hj),1,fp); if(n=1) head=p; else q-next=p; q=p; q-next=NULL; struct hj *h1,*p2,*q3,*r4,*s5; h1=p2=(hj *)malloc(si
55、zeof(struct hj); p2-next=head; while(p2-next!=NULL) q3=p2-next; r4=p2; while(q3-next!=NULL) if(q3-next-numbernext-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&n0) n-; printf(n學(xué)號=%ld =%s,
56、p-number,p-name); printf(n地址=%s,p-address); p=p-next; xxxx: printf(n顯示完畢n返回上級菜單 退出程序 n請 選 擇 :);xxx: scanf(%d,&n); switch(n) case 1:break; case 2:exit(0); default:printf(n錯誤的選擇,請重新選擇:); goto xxx; void hjselect(void)/查詢編輯信息函數(shù) cxbegin: int a; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 查詢編輯信息nnn); pri
57、ntf(n 一 按學(xué)號方式查詢n); printf(n 二 按方式查詢n); printf(n 三 按籍貫方式查詢n); printf(n 四 顯示全部信息n); printf(n 五 返回上級菜單n); printf(n 請 選 擇 查 詢 方 式:);cxmm: scanf(%d,&a); switch(a) case 1: hjxmselect();goto cxbegin;break; case 2: hjxhselect();goto cxbegin;break; case 3: hjjgselect();goto cxbegin;break; case 4: allselect(h
58、j.txt);goto cxbegin;break; case 5: break; default:printf(n錯誤的選擇,請重新選擇:); goto cxmm; void hjde(void)/刪除界面函數(shù)cxxbegin: int a; system(cls); printf(n 歡迎使用戶籍管理系統(tǒng)n); printf(n 刪除信息nnn); printf(n 一 按學(xué)號方式刪除n); printf(n 二 按方式刪除n); printf(n 三 按籍貫方式刪除n); printf(n 四 刪除全部信息n); printf(n 五 返回上級菜單n); printf(n 請 選 擇 刪 除 方 式:);cxxmm: scanf(%d,&a); int i=0; switch(a) case 1: hjxmselect();goto cxxbegin;break; case 2: hjxhselect();goto cxxbegin;break; case
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度個人住宅水電安全檢測與維修服務(wù)合同4篇
- 2024年企業(yè)、公司經(jīng)營管理戰(zhàn)略方案及技巧知識考試題庫(附含答案)
- 2025版探礦權(quán)轉(zhuǎn)讓協(xié)議范本:礦產(chǎn)資源合作開發(fā)新策略3篇
- 2025版新能源產(chǎn)業(yè)園區(qū)土地合作開發(fā)協(xié)議書3篇
- 2025版施工安全協(xié)議書:高空作業(yè)安全協(xié)議范本3篇
- 二零二五年度車輛租賃合同車輛租賃保險條款4篇
- 合作式學(xué)習(xí)在小學(xué)數(shù)學(xué)課堂中的應(yīng)用案例
- 2025版文藝團體演出合作委托合同3篇
- 跨文化交流拓寬視野培養(yǎng)孩子獨立見解
- 甘肅2025年甘肅西北師范大學(xué)誠聘海內(nèi)外高層次人才160人筆試歷年參考題庫附帶答案詳解
- 醫(yī)院6s管理成果匯報護理課件
- 泵站運行管理現(xiàn)狀改善措施
- 2024屆武漢市部分學(xué)校中考一模數(shù)學(xué)試題含解析
- SYT 0447-2014《 埋地鋼制管道環(huán)氧煤瀝青防腐層技術(shù)標(biāo)準(zhǔn)》
- 第19章 一次函數(shù) 單元整體教學(xué)設(shè)計 【 學(xué)情分析指導(dǎo) 】 人教版八年級數(shù)學(xué)下冊
- 浙教版七年級下冊科學(xué)全冊課件
- 弧度制及弧度制與角度制的換算
- 瓦楞紙箱計算公式測量方法
- 江蘇省中等職業(yè)學(xué)校學(xué)業(yè)水平考試商務(wù)營銷類(營銷方向)技能考試測試題
- DB32-T 4004-2021水質(zhì) 17種全氟化合物的測定 高效液相色譜串聯(lián)質(zhì)譜法-(高清現(xiàn)行)
- DB15T 2724-2022 羊糞污收集處理技術(shù)規(guī)范
評論
0/150
提交評論