




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 PAGE35 / NUMPAGES35程序设计课程设计报告课题名称: 学生籍贯信息记录簿专业 计算机科学与技术(软件工程)学生班级学号指导教师完成日期一 课程设计的目的1二 设计容与要求1三 主要技术指标与特点13.0 信息描述(注:用流程图表示)13.1 创建信息链表并以磁盘文件保存;23.2 读取磁盘文件并显示输出所有学生的籍贯信息;33.3 按学号或查询其籍贯;53.4 按籍贯查询并输出该籍贯的所有学生;93.5 能添加、删除和修改学生的籍贯信息;113.6 显示输出籍和非籍学生的信息并可分别存盘。16四 设计小结17五 程序源代码18六 参考文献29课程设计的目的加深对C语言程序设计
2、课程知识的理解,掌握C语言应用程序的开发方法和步骤; 进一步掌握和利用C语言进行课程设计的能力;进一步理解和运用结构化程序设计的思想和方法;初步掌握开发一个小型实用系统的基本方法;学会调试一个较长的程序的基本方法;学会利用流程图或N-S图表示算法;掌握书写课程设计开发文档的能力(书写课程报告)。二设计容与要求 编制一个学生籍贯信息记录簿,每个学生信息包括:学号、籍贯。具体功能要求如下: 1创建信息链表并以磁盘文件保存;2读取磁盘文件并显示输出所有学生的籍贯信息;3按学号或查询其籍贯;4按籍贯查询并输出该籍贯的所有学生;5能添加、删除和修改学生的籍贯信息;6显示输出籍和非籍学生的信息并可分别存盘
3、。三.主要技术指标与特点3.0 信息描述 (注:用流程图表示)籍贯信息记录簿建立链表录入信息显示信息查询信息编辑信息分类管理主函数添加信息删除信息修改信息3.1 创建信息链表并以磁盘文件保存;/*建立链表*/struct hj long number; char name10,address50; struct hj *next;/*文件操作函数*/FILE *fp;void openfile(char xx20) fp=fopen(xx,ab+); if(fp=NULL) fp=fopen(xx,wb);/*主函数*/int main(int argc, char* argv) begin:
4、 int t; system(cls); printf(n 欢迎使用户籍管理系统nnnnn); printf( 一 录入学生籍贯信息nn); printf( 二 查编学生籍贯信息nn); printf( 三 删除学生籍贯信息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; 读取磁盘文件并显示输出所有学生的籍贯信息;void allselect(char a8)/全部查询 int n=0;int k=0; system(cls); printf(n 欢迎使用户籍管理系统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学号=%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)/查询编辑信息函数 cxbegin: int a; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 查询编辑信息nnn); printf(n 一 按学号方式查询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 按学号或查询其籍贯;/*查询函数*/void hjxmselect(void) /按学号方式查询函
10、数ssmmx: int n=0; long hh; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 查询编辑信息n); printf(n 提示输入0返回上级菜单nnn); printf( 请您输入学号:); 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 结 果 学号=%ld =%s,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询其他数据 返回上页 退出程序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)/按方式查询函数ssmm: int n=0; char hh10; system(cls); printf(n 欢迎使用户籍管理
14、系统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 结 果 学号=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询其他数据 返回上页 退出程序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 按籍贯查询并输出该籍贯的所有学生;void hjjgselect(void)/按籍贯方式查询yyy: int i; system(cls); printf(n 欢迎使用户籍管理系统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 欢迎使用户籍管理系统n); printf(n 自定义查询信息nnn); printf( 请您输入地址关键字:); 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 结 果
21、 学号=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询下一条数据 返回上页 退出程序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没有匹配的记录 按任意键继续!); getch(); fclose(fp); goto ssmmz; else int xx; printf(nn查询完毕! 继续查询 返回上一级菜单 退出程序); printf(n请选择:); scanf(%d,&xx); if(x
23、x=2) goto jjz; else if(xx=3) exit(0); goto ssmmz;jjz: ; 能添加、删除和修改学生的籍贯信息;/*录入信息函数*/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 欢迎使用户籍管理系统n); printf(n 录入信息n); printf(n 提示输入0返回上级菜单nnn); printf(n 请输
24、入学号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 请输入学号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)/删除界面函数cxxbegin: int a; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 删除信息nnn); printf(n 一 按学号方式删除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 全部数据已经删除!敲任意键继续); getch(); goto cxxbegin;break; case 5: break; default:printf(n错误的选择,请重新选择:); goto cxxmm; /=删除函数接口=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);/=编辑函数接口=void hjedit(struct hj *headd,struct hj *pp) int n=0; struct hj *p,*p1,*p2; char d5=; printf(n 输 入 学号=); 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 显示输出籍和非籍学生的信息并可分别存盘。 void hjjgselect(void)/按籍贯方式查询yyy: int i; system(cls); printf(n 欢迎使用户籍管理系统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); 四设计小结课程设计是培养学生综合运用所学知识、发现、提出、分析和解决实际问题,锻炼实践能力的重要环节,是对学生实际工作能力的具体训练和考察过程。随着科学技术的发展,当今计算机存活在世界的每一个角落。因此,作为二十一世纪的大学生来说,掌握计算机开发技术是非常正要的。对于此次课程设计,感慨颇多。的确,从拿到题目到完成整个编程,从理论到实践,在两周时间里,可以学到很多很多的东西,同时不仅可以巩固以前所学过的知识,还学到了许多书本上没有的
35、知识。通过这次课程设计,我懂得了理论与实践相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识和实践相结合起来,从理论中得出结论,才能真正的提高自己的实际动手能力和独立思考的能力,才能真正的为社会服务。在设计过程中,可以说是困难重重,毕竟很久没有接触过C语言了,很多基础知识都忘记了,难免会遇到各种各样的问题,比如scanf每加&或缺少之类的小错误都要花很长时间找出来,另外对文件的读写等操作以前一直不大清楚,这次课程设计中包含了许多对文件的操作,使我对文件操作的能力有了很大的提高。正所谓:温故而知新!两周的课程设计结束了,期间遇到了很多问题,这次设计在老师和同学的指导与帮助下、查阅资
36、料以与借鉴网上原有的同类程序代码得以完成。 我也意识到自己掌握的知识还很缺陷,在以后的课程学习中,我要更加认真仔细,全面地了解相关知识。五.程序代码#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;/*文件操作函数*/FILE *fp;void openfile(char xx20) fp=fopen(xx,ab+)
37、; if(fp=NULL) fp=fopen(xx,wb);/*录入信息函数*/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 欢迎使用户籍管理系统n); printf(n 录入信息n); printf(n 提示输入0返回上级菜单nnn); printf(n 请输入学号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 请输入学号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:;/*查询函数*/void hjxmselect(void) /按学号方式查询函数ssmmx: int n=0; long hh; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 查询编辑信息n); printf(n 提示输入0返回上级菜单nnn); printf( 请您输入学号:); 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 结 果 学号=%ld =%s,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询其他数据 返回上页 退出程序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)/按方式查询函数ssmm: int n=0; char hh10; system(cls); printf(n 欢迎使用户籍管理系统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 结 果 学号=%ld =%s ,p-numbe
46、r,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询其他数据 返回上页 退出程序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 欢迎使用户籍管理系统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、统n); printf(n 自定义查询信息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 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 结 果 学号=%ld =%s ,p-number,p-name); printf(n 地址=%s,p-address); printf(nn 操 作 更改数据 删除数据 查询下一条数据 返回上页 退出程序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、 按任意键继续!); getch(); fclose(fp); goto ssmmz; else int xx; printf(nn查询完毕! 继续查询 返回上一级菜单 退出程序); 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 欢迎使用户籍管理系统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学号=%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)/查询编辑信息函数 cxbegin: int a; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 查询编辑信息nnn); pri
57、ntf(n 一 按学号方式查询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)/删除界面函数cxxbegin: int a; system(cls); printf(n 欢迎使用户籍管理系统n); printf(n 删除信息nnn); printf(n 一 按学号方式删除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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度租房转租合同变更及续约补充协议
- 2025年度家庭子女入学租房保障合同
- 2025年农村房屋赠与及附属设施拆除重建合同
- 中国一次性防护手套市场供需现状及投资战略研究报告
- 2025年中国彩色石英管液位计市场全面调研及行业投资潜力预测报告
- 2025年度教育培训机构兼职教师协议模板
- 二零二五年度城市综合体经营授权协议
- 2025年度两人合租房屋租赁合同(含户外探险俱乐部)
- 二零二五年度电车租赁与智能调度系统建设合同
- 二零二五年度股权与合伙人协议书综合实施手册
- 高中转学申请书
- 2025年中国建材集团所属中建材联合投资有限公司招聘笔试参考题库附带答案详解
- 2025年企业合伙联营框架协议模板(2篇)
- 中国电信行业人工智能行业市场调研及投资规划建议报告
- 水幕喷淋系统的工作原理与应用
- 门楼施工方案
- 2024年山东海洋集团有限公司社会招聘考试真题
- 小学生拗九节课件
- 《感冒中医治疗》课件
- 研发费用管理制度内容
- 压力容器设计委托书
评论
0/150
提交评论