学生学籍管理系统实验报告及源代码_第1页
学生学籍管理系统实验报告及源代码_第2页
学生学籍管理系统实验报告及源代码_第3页
学生学籍管理系统实验报告及源代码_第4页
学生学籍管理系统实验报告及源代码_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、课程设计目的加深对C语言课程所学知识的理解,进一步巩固 C语言语法规则。学会编制 结构清晰、风格良好、数据结构适当的C语言程序,从而具备解决综合性实际问题的 能力,使学生通过系统分析、系统设计、编程调试,写实验报告等环节,初步掌握软 件系统设计的方法和步骤,训练灵活运用程序设计语言进行软件开发的能力,提高分 析问题和解决问题的能力,提高程序设计水平,培养必要的工程实践动手能力、课程设计内容学生学籍管理系统1,输入并验证密码;2,设计菜单进行选择相应的操作;3,用链表录入并输出数据,包括学生的户籍、成绩、奖惩信息;4,将录入的数据存放在文件里面并读取文件;5,对录入的数据进行修改;6,删除个人信

2、息;7,查找个人信息;8,对录入的成绩进行排序;9,统计不及格的成绩;10,释放链表;三、需求分析对所开发系统功能、性能的描述,想要实现的目标。输入并验证密码的正确性,定义结构体类型来存放学生的基本信息(包括学生的姓 名、学号、性别、出生日期等),然后建立链表存放信息将信息存入文件中,以便以后的 各个功能模块调试时直接调用,对数据进行修改、删除、查找、排序操作,然后对输 入的数据进行统计,查出不及格的学生成绩。实现的目标是对学生的学籍进行管理, 更新并统计数据。四、概要设计输入数据函数若相同则功能模块说明:输入密码:从键盘输入密码,判断输入的密码是否与系统设定的密码相同, 进入主菜单,不相同则

3、继续输入;主菜单:显示系统的各项功能与相对应的数字选项。输入数据函数:从键盘输入数据,并将数据存入链表。 输出数据函数:对存储的数据进行输出。查找数据函数:对存储的数据进行查询并显示查询结果。删除数据函数:对存入的数据进行删除。修改数据函数:对存入的数据进行修改。保存数据函数:将从键盘输入的数据存入到文件中 读取数据函数:从文件中读取个人信息。排序函数:对平均成绩进行排序并显示排序结果 统计函数:对不及格成绩进行统计并显示统计结果。退出系统:退出系统 五、详细设计及运行结果流程图错 误否是选择2否选择1从键盘输入数据并存入链表输岀数据是查找个人信息选择3是删除数据选择4否是修改数据选择5否是保

4、存文件选择6否是读取文件选择7否是对成绩进行排序否是选择9统计不合格的成绩选择8退出六、调试情况,设计技巧及体会通过两周的课程设计,我对学过的 C语言基本知识进行了巩固,并且还对知 识进行了扩展。在本次实习时,刚开始完全没有头绪,不知道从何入手,感觉难度很大 但是逐渐开始编写程序慢慢发现,原来不是想象中的那么难在一个个模块成功编写出 来的同时,获得了巨大的成就感,并且掌握的许多上课遗漏和不很了解的知识.。对一些 细节以前不太注意,常常忽略,真正操作起来时发现一些小问题也会导致程序无法进 行。要想运行正常,必须保证零错误。同时,这两周的实习使我对链表更熟悉了。以前总感觉链表很难,这次程序p Ch

5、ina dodevderlooppmewnetagkl bird firsotbflayl of one deepandcthhaenigne, aNacncpoirndginrge to senarecwh stduedvyelporpompeonstedconcept of gravidtyoXjioab;m(o6)vpedra,ctaind inncoevlaitionnemSeoccihaalnisit core value设计中,我用链表存取数据,并进行删除修改等操作,慢慢对链表熟悉。另外,在程序运行编译的过程中出现一些错误,需要耐心的去检查错误,调试程序。七、参考文献C语言程序设计

6、C语言程序设计教程C语言程序设计谭浩强张毅坤 曹锰 张亚玲王曙燕 曹锰清华大学出版社 西安交通大学出版社 科学出版社#include #include #include #include #include #include #include #define LEN sizeof(struct student)typedef struct int year;int month;int day; DATE;struct student int num;char name10;char sex;DATE birthday;intmath;intC;intphysic;intEnglish;float

7、average;DATE time;charreason50;charresult50;charunit50;struct student *next;struct student * read_file();/*读取文件 */void save_file();/* 保存 */void input();/* 创建链表,输入数据 */void output(struct student *head); /*输出 */ void seek(struct student *h);/* 查找*/void del() ;/* 删除 */void change ();/* 修改 */void sort()

8、 ;/*对成绩进行排序*/void summarise。;/*对不及格成绩进行统计*/void freenklist(void);/*释放链表 */void print(struct student *p);/*输出函数 */void men u();/* 菜单 */voidpassword。;/* 密码 */struct stude nt *head=NULL;int nu mber=0;mai n() password();getch();system(cls);printf(nnnnnttt*欢迎进入学生学籍管理系统 *nnn);getch(); menu();void password

9、()char s8,ch; int i;s0=0;s1=4; s2=0; s3=8 ; s4=2; s5=0; s6=4; s7=1;prin tf(nnnnnttt*nn);prin tf(ttt* *nn);prin tf(ttt*nnnnn);doprin tf(ttttplease in put password: nttttt); for(i=0;i num);fflush(stdi n);scanf (%s,p1- n ame);fflush(stdi n);scanf (%c,&p1-sex);fflush(stdi n);scanf(%d%d%d,&p1-birthday.ye

10、ar,&p1-birthday.mo nth,&p1-birthday.day);printf (score in formatio n:n);printf (math C physic En glishn);scanf (%d%d%d%d,&p1-math,&p1-C,&p1-physic,&p1-E nglish); p1-average=(float)(p1-math+p1-C+p1-physic+p1-E nglish)/4; prin tf( rewards and puni shme nts:n);printf ( time(year month day )n);scanf (%d

11、%d%d,&p1-time.year,&p1-time.mo nth,&p1-time.day); printf (reas on:);fflush(stdi n);sca nf (%s,p1-reas on);printf (result:);fflush(stdi n);scanf (%s,p1-result);printf (u nit:);fflush(stdi n);scanf (%s,p1-u nit);p1- next=NULL;nu mber+;if(head=NULL)head=p1;elsep2=head;while (p2-n ext ) p2=p2-n ext; p2-

12、n ext=p1;getch();void output(struct student *head) /* 输出链表 */struct stude nt *p;int kin d,flag=1;char choice=a;if (head=NULL)printf(Not Input before!n);getch();return;while (flag)printf (students information input before as fowllow:n);printf (1:address; 2:score; 3:rewards and punishments 0:exitn);pr

13、intf (please choice: );scanf (%d,&kind);p=head;doswitch(kind) case 1:printf (address information:n);printf (num name sex year month day n);printf (%d %s %c ,p-num,p-name,p-sex);printf( %d %d %dn,p-birthday.year,p-birthday.month,p-birthday.day);break;case 2:printf (score information:n);printf (num na

14、me math C physic English averagn);printf (%d %s %d %d %d %d ,p-num ,p-name ,p-math,p-C,p-physic,p-English);printf (%2.2fn,p-average);break;case 3:printf( rewards and punishments:);printf (num : %d name %s n,p-num,p-name);printf (time: year/%d month/%d day/%dn,p-time.year,p-time.month,p-time.day);pri

15、ntf(reason: %sn,p-reason);printf(result: %sn,p-result);printf (unit: %sn,p-unit);break;p=p-next;while(p);printf (continue to choice (y/n) );fflush(stdin);choice=getchar();if(choice=n)flag=0;prin tf(Display fin ish!n); getch();void seek(struct student *h)/* 查找链表 */struct stude nt *p;intseek num;print

16、f (please in put the num what you look for :);scanf (%d,&seek nu m);p=h;while (p&seek nu m!=p-num)p=p-n ext;if(!p)printf (the num you look for dont exist!n);elseprin t(p);getch();void del ()/* 删除链表 */int delnum;struct stude nt *p1,*p2;p仁head;prin tf(i nput delete nu m:n);sca nf(%d,&del nu m);while (

17、del nu m!=p1- num&p1- next!=NULL)p2=p1;p1=p1- n ext;if (del num=p1- num)if (p1=head)head=p1- n ext;elsep2-n ext=p1- n ext;printf (the stude nts in formatio n you in put have bee n deleted!n); nu mber-;elseprintf (the stude nt you what to delete dont exist!n); getch();void change()/* 修改链表 */int cha n

18、genu m,k ind;int choice,flag=1;char select=1;struct student *p;p=head;while (flag!=0) printf (please input the num you want to change:n);scanf (%d,&changenum);while (changenum!=p-num)p=p-next;if (changenum=p-num)printf (input the new information:n);printf (1:address ; 2:score ;3: rewards and punishm

19、ents; 0:exit;n);printf(input the kind you want to change:);fflush(stdin);scanf(%d,&kind);switch(kind) case 1:printf (1: name; 2:sex; 3:birthday;);printf (please choice :);fflush(stdin);scanf (%d,&choice);switch (choice) case 1:printf (input the new name:);fflush(stdin);scanf (%s,p-name);break;case 2

20、:printf (input the new sex:);fflush(stdin);scanf(%c,&p-sex);break;case 3:printf (input the new birthday:);fflush(stdin);scanf(%d%d%d,&p-birthday.year,&p-birthday.month,&p-birthday.day);break;break;case 2:printf (1:math; 2:C; 3: physics; 4:English;);printf (please choice :);fflush(stdin);scanf (%d,&c

21、hoice );switch (choice) case 1:printf (input the new math:);fflush(stdin);scanf (%d,&p-math);break;case 2: printf (input the new C:); fflush(stdi n); scanf (%d,&p-C); break;case 3: printf (i nput the new physic:); fflush(stdi n);scanf (%d,&p-physic);break;case 4: printf (i nput the new En glish:); f

22、flush(stdi n);scanf (%d,&p-E nglish); break; break;case 3:printf (1: time; 2:reson; 3: result; 4: unit;); printf (please choice:);fflush(stdi n);sca nf (%d,&choice);switch (choice) case 1: printf (i nput the new time:); fflush(stdi n);scanf(%d%d%d,&p-time.year,&p-time.mo nth,&p-time.day);break;case

23、2: printf (i nput the new reas on:); fflush(stdi n);sca nf (%s,p-reas on);break;case 3: printf ( i nput the new result :); fflush(stdi n);scanf (%s,p-result);break;case 4: printf (i nput the new un it:); fflush(stdi n);scanf (%s,p-u nit);break; else printf (the num you want to cha nge dont exist!n);

24、printf(continue to cha nge ?(y/n 门;fflush(stdin);select=getchar();if(select=n) flag=0;elseprintf (continue!n);print(p);getch();void save_file()/* 保存文件 */ FILE *fp;struct student *stu;char filename10;printf (input infile name:n);scanf (%s,filename);if (fp=fopen(filename,wb+)=NULL) printf (cannot open

25、 file!); exit(0);stu=head;do if(fwrite(stu,LEN,1,fp)!=1) printf (file write error!);stu=stu-next;while(stu);printf (the file has been kept!n);fclose (fp);getch();struct student * read_file()/* 读取文件 */ FILE *fp;char filename10;struct student *p,*head=NULL,*stu; printf (please input filename:n); scanf

26、(%s,filename);if (fp=fopen(filename,rb+)=NULL) printf (the file dont exist!); exit(0);stu=p=(struct student *) malloc(LEN); if(head=NULL)fread(stu,LEN,1,fp); head=stu;while (p-next!=NULL)p-n ext=stu;p=stu;stu=(struct stude nt *) malloc(LEN);fread(stu,LEN,1,fp);p-n ext=NULL;fclose (fp);prin tf(read s

27、ucess!n);return (head);getch();void prin t(struct stude nt *p)/* 输出 */printf (the new in formatio n is:n);printf (address in formatio n:n);printf (num: %d name %s sex %cn ,p-num ,p-name ,p-sex);printf (year:%dmon th%dday%dn,p-birthday.year,p-birthday.m on th,p-birthday.day);printf (score in formatio

28、 n:n);printf (math: %d C: %dphysic:%dEn glish:%d,p-math,p-C,p-physic,p-E nglish);prin tf( average: %2.2f n ,p-average);prin tf( rewards and puni shme nts:n);printf (time:year/%dmon th/%dday/%dn,p-time.year,p-time.mo nth,p-time.day);prin tf(reas on: %sn ,p-reas on);prin tf(result:%sn,p-result);printf

29、 (u nit:%sn,p-u nit);void sort()/*对成绩进行排序*/int i=O,j,k ,n=0;struct student stu50,t,*p;head=read_file();for(p=head;p;p=p-n ext)stui. num =p-num ; strcpy(stui. name,p-n ame ); stui.math =p-math ; stui.C =p-C ;stui.physic =p-physic ; stui.E nglish =p-E nglish ; stui.average =p-average ;i+;n+;for(j=0;j

30、n ;j+) for(k=j+1;k n-1;k+)if(stuj.averagestuk.average)t=stuj;stuj=stuk;stuk=t;for(i=0;inext) if(p-mathnum); printf ( %s ,p-name); printf ( %d n,p-math); printf(n C:n); printf ( num name C:n); for(p=head;p ;p=p-next) if(p-Cnum);printf (%s,p-name);printf (%dn,p-C);printf(nphysic:n);printf (numnamephysic:n);for(p=head;p;p=p-next) if(p-physic)num); printf ( %s ,p-name); printf ( %d n ,p-physic);prin tf(nEn glish:n);printf ( numn ameEn glish :n);for(p=head;p;p=p-n

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论