c语言程序的设计_学生成绩管理系统方案

上传人:泽*** 文档编号:67711238 上传时间:2022-03-31 格式:DOC 页数:43 大小:462KB
收藏 版权申诉 举报 下载
c语言程序的设计_学生成绩管理系统方案_第1页
第1页 / 共43页
c语言程序的设计_学生成绩管理系统方案_第2页
第2页 / 共43页
c语言程序的设计_学生成绩管理系统方案_第3页
第3页 / 共43页
资源描述:

《c语言程序的设计_学生成绩管理系统方案》由会员分享,可在线阅读,更多相关《c语言程序的设计_学生成绩管理系统方案(43页珍藏版)》请在装配图网上搜索。

1、.实验题目 :学生成绩管理系统一、实验目的1. 熟悉 c 语言的编译连接和运行过程 。2. 掌握 c 语言的数据类型 ,熟悉整型 、实型、字符型变量的定义方式及如何给它们赋值 。3. 掌握 if 语句及 switch 语句的运用方法及嵌套应用方法 。4. 掌握实现循环结构的三种语句 while 、 do-while. 、for 的使用 。5. 掌握函数的定义方法和调用方法 。6. 能够采用模块化思想调试程序 。二实验内容1. 编写程序并进行调试运行 。2. 输入学生资料 ,并保存于文件 。 每个学生包含信息如 :姓名、学号、性别、物理成绩 、数学成绩 、英语成绩 、计算机成绩 。3. 对已存入

2、的学生信息进行更新操作 ,包括更新学生信息信息 、删除某个学生信息和修改学生信息 。4. 通过按学生姓名的方式查询学生信息 。5.输入某学生各门成绩进行统计。6 对学生物理成绩排序 。7.最后输出学生信息 ,供需要时打印 。二、需求分析1. 该程序可用于对学生的基本信息的存储 、更新、查询、输出、统计、排序等操作。2. 其中更新功能包括 :添加信息 、删除信息 、修改信息 、可根据需要添加一个或多个学生 信息 ,也可对个别学生信息进行适当的删除或修改 。以便随时更新学生信息 。3. 程序中设计的查询功能可根据需要从若干数据中查询某信息,.下载可编辑 .四、概要设计1、方案设计对系统进行分析 ,

3、给出结构图分析:系统要求实现许多的功能 ,因此遵循结构化程序设计思想来进行本系统的设计 自顶向下 、逐步细化 ,将系统设计任务分解出许多子功能模块进行设计结构图如下 :学生成绩管.下载可编辑 .显输插查更统成物数英计保输示入入看新计绩理学语算存出数数数数数成排成成成机数数据据据据据绩序绩绩绩成据据绩更删修物数英计物新除改理学语算理数数数总总总机成据据据分分分平绩和和和均排平平平分序五功能模块的说明1 输入初始学生信息 :其中包括学生姓名 ,学号,性别,物理 数学英语 计算机成绩等相关信息 ;可用函数 cin(stu *p1) 来实现此操作 。.下载可编辑 .2 查询模块 :可用 stu *lo

4、okdata(stu *p1)来实现 。找到就输出此学生全部信息包括学生物理数学 英语 计算机的成绩。3 插入模块 :可用 insert() 来实现 。 其中通过学号的大小比较的 ,并且以此来排序。4 输出学生的信息及成绩 :通过学生的姓名来查看学生的语文 数学 英语 计算机的有 关成 绩,同时也可 以分 别通过paverage()maverage()eaverage()comaverage() 来输出物理数学 英语 计算机等成绩的平均分最高分 最低分。5 退出系统 :可以用一个函数来实现,首先将信息保存在文件中,释放动态创建的内存空间 ,再退出次程序 。流程图如下六 调试情况及运行结果1、

5、对自己设计进行评价 ,指出合理和不足之处 ,提出改进的方案 。此次实践课编写的是一个应用程序 ,相对于以前我们见到的程序 ,它要大得多 ,于是就按课本上的例子编了超市管理系统 ,先把界面弄好然后再添加各模块 ,而且各模块也出现了不少问题 ,在同学们和老师的帮助下 ,我很有耐心的一次又一次的进行修改 ,最后运行的结果基本上达到了预期的目的 。可结果还不是太理想 。由于时间很短 ,在选题报告中设想到的好多功能都没有实现。已有的那些功能虽已能基本上满足管理者和消费者的需要 ,但如果还有更多的功能程序就会更加完美 。如 :进入系统时没有设制密码 ,保护性不够强;在输入商品号时没有出错提示 ,如果商品号

6、输入负值2、在设计过程中的感受 。本次 C 语言的实习课让我对C 语言的学习又有了更深入的了解,也让.下载可编辑 .我更深刻地领悟到了 “实践出真理 ”这个道理 ,在上机实践过程中学到的知识远远超过了在课堂上十几周学到的 ,学校组织的这次实习让我们这些实践知识匮乏的大学生增添了许多社会经验 ,为我们将来走上工作岗位其了不小的铺垫作用 。本次实习中遇到了很多以前没有遇到过的问题 ,也曾想过要放弃 ,但看到那些同学都在那认真的写程序 ,给了我继续的信心 。 在同学的帮助下,我顺利的结束了本次实习 ,让我知道原来凭借自己努力取得的成功会让自己这么欣慰 ,也让我知道了友谊和团结的重要性 。七参考文献C

7、 语言程序设计 王曙燕曹锰科学出版社八。附录:#include #include #include #include #include #include #define MAX 10int sum=10;typedef struct student/* 定义结构体 */char nameMAX;/* 姓名 */int num;/* 学号 */char sexMAX;/* 性别 */.下载可编辑 .float physic;/* 语文 */float mathematic;/* 数学 */float english;/* 英语 */float computer;/* 计算机 */struct s

8、tudent *next;/* 结构体指针 */stu;stu *head;/* 读取信息 */int read_message() FILE *fp;stu *p;int i=0;if(fp=fopen(student_manage.txt,rb)=NULL) printf(nn*暂时还没有任何信息,输入密码进入主菜单选择基本信息录入!*n);return0;.下载可编辑 .while(feof(fp)!=1) fread(head,sizeof(stu),1,fp);if(p-num=0) break;else i+;fclose(fp);return(i);/* 显示或打印函数*/voi

9、d print()printf(tttScore ManageSystemn);/* 成绩管理系统 */printf(ttt成绩管理系统 n);printf(EnterRecord :输入数据n);/* 输入数据 */printf(Display:显 示 或 打 印n);/* 显示 */printf(find:查找数据n);/* 访.下载可编辑 .问数据 */printf(Renew_message:更新模块n);/* 更新模块 */printf(Save:保存数据n);printf(sort_physic:成绩排名n);/*物理成绩排名 */printf(Count:数 据 统 计n);/*

10、 数据统计 */printf(Physic Average:物理平均成绩n);/*物理平均成绩 */printf(MathAverage :数学平均成绩n);/* 数学平均成绩*/printf(EnglishAverage: 英语平均成绩n);/* 英语平均成绩*/printf(ComputerAverage: 计算机平均成绩n);/* 计算机平均成绩*/printf(Quit:退出tn);/* 退出 */.下载可编辑 ./* 输入相关数据函数*/void cin(stu *p1)printf(n Enter name:n);scanf(%s,&p1-name);printf(Enter nu

11、m:n);scanf(%d,&p1-num);printf(Enter sex:n);scanf(%s,&p1-sex);printf(Enter scoren);printf(Enter physic:n);scanf(%f,&p1-physic);printf(Enter mathematic:n);scanf(%f,&p1-mathematic);printf(Enter english:n);scanf(%f,&p1-english);printf(Enter computer:n);scanf(%f,&p1-computer);.下载可编辑 ./* 其他数据是否输入函数*/stu *

12、cindata() stu *p1,*p2; int i=1;char ch;p1=(stu*)malloc(sizeof(stu);head=p1;while(i) cin(p1);printf(Do you want to continue?Yes or no:n);fflush(stdin);ch=getchar();if(ch=n|ch=N) i=0;p1-next=NULL;else p2=p1;.下载可编辑 .p1=(stu*)malloc(sizeof(stu);p2-next=p1;return(p1-next);/* 查看数据函数*/stu *lookdata(stu *p1

13、)while(p1!=NULL)printf(Name:%st,p1-name);printf(Num:%dt,p1-num);printf(Sex:%st,p1-sex);printf(n);printf(Physic:%ft,p1-physic);printf(Math:%ft,p1-mathematic);.下载可编辑 .printf(English:%ft,p1-english);printf(Computer:%ft,p1-computer);printf(n);p1=p1-next;returnp1;/* 通过比较学号来插入数据的函数*/void insert() stu *p1,

14、*p3,*p2; p1=head; p3=(stu*)malloc(sizeof(stu);p3-next=NULL;if(head=NULL) head=p3;return;.下载可编辑 .cin(p3);while(p1!=NULL&(p1-numnum) p2=p1;p1=p1-next;if(p2=head) p3-next=head; head=p3;return; p3-next=p1;p2-next=p3;/* 通过姓名来查找的函数*/void find(stu *p2) char name20;int b=0;printf(Enter the name of the sutde

15、nt you want to find:);scanf(%s,name);while(p2!=NULL)if(strcmp(name,p2-name)=0).下载可编辑 . printf( The data you want has be find );printf(Name:%st,p2-name);printf(Num:%dt,p2-num);printf(Sex:%st,p2-sex);printf(n);printf(Physic%ft,p2-physic);printf(Math%ft,p2-mathematic);printf(English%ft,p2-english);prin

16、tf(Computer%ft,p2-computer);printf(n);b=1;else if(b=0)printf(sorry not find data!);p2=p2-next;if(b=1)print();printf(Find onen);.下载可编辑 .elseprint();printf(Not findn);/* 求各学生物理平均成绩*/void paverage() stu *p1;int i;float max=0.0,min=200.0;float sum=0.0,aver=0;p1=head;.下载可编辑 .if(p1=NULL)printf(not data!);

17、else for(i=0;p1!=NULL;p1=p1-next) sum+=p1-physic; aver=sum/i;p1=head;for(i=0;p1!=NULL;i+,p1=p1-next)if(maxphysic)max=p1-physic;p1=head;for(i=0;p1!=NULL;i+,p1=p1-next)if(minp1-physic)min=p1-physic;printf(Physic Average:%f ,aver);printf(Physic Max:%f,max);printf(Physic Min:%f,max);.下载可编辑 ./* 求各学生数学平均分

18、最高和最低分成绩的函数*/void maverage() stu *p1;int i;float max=0.0,min=200.0;float sum=0.0,aver=0;p1=head;if(p1=NULL)printf(not data!);elsefor (i=0;p1!=NULL;i+,p1=p1-next)sum+=p1-mathematic;aver=sum/i;p1=head;.下载可编辑 .for(i=0;p1!=NULL;i+,p1=p1-next) if(maxmathematic)max=p1-mathematic;p1=head;for(i=0;p1!=NULL;i

19、+,p1=p1-next)if(minp1-mathematic)min=p1-mathematic;printf(Math Average:%f,aver);printf(Math Max:%f,max);printf(Math Min:%f,min);/* 求各学生英语平均分最高和最低分成绩的函数*/.下载可编辑 .void eaverage() stu *p1;int i;float max=0.0,min=200.0;float sum=0.0,aver=0;p1=head;if(p1=NULL)printf(not data!);elsefor(i=0;p1!=NULL;i+,p1=

20、p1-next)sum+=p1-english;aver=sum/i;p1=head;for(i=0;p1!=NULL;i+,p1=p1-next) if(maxenglish) max=p1-english;p1=head;.下载可编辑 .for(i=0;p1!=NULL;i+,p1=p1-next)if(minp1-english)min=p1-english;printf(English Average:%f,aver);printf(English Max:%f,max);printf(English Min:%f,min);/* 求各学生计算机平均成绩最高和最低分 */void co

21、maverage() stu *p1;int i;float max=0.0,min=200.0;float sum=0.0,aver=0;p1=head;.下载可编辑 .if(p1=NULL)printf(not data!);elsefor(i=0;p1!=NULL;i+,p1=p1-next)sum+=p1-computer;aver=sum/i;p1=head;for(i=0;p1!=NULL;i+,p1=p1-next) if(maxcomputer)max=p1-computer;p1=head;for(i=0;p1!=NULL;i+,p1=p1-next)if(minp1-com

22、puter)min=p1-computer;printf(Computer Average:%f,aver);printf(Computer Max:%f,max);printf(Computer Min:%f,min);.下载可编辑 ./* 统计物理平均和总分*/void aver_sum_physic() stu *p1;int i;float sum=0,aver;p1=head;if(p1=NULL)printf(not data!);else for(i=0;p1!=NULL;i+,p1=p1-next)sum+=p1-physic;aver=sum/i;printf(Physic

23、Average:%f,aver);.下载可编辑 .printf(Physic Sum:%f,sum);/* 统计数学平均和总分*/void aver_sum_mathematic() stu *p1;int i;float sum=0,aver;p1=head;if(p1=NULL)printf(not data!);else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-mathematic; aver=sum/i;printf(Mathematic Average:%f,aver);printf(Mathematic Sum:%f,sum);.下载可编辑

24、./* 统计英语平均和总分*/void aver_sum_english() stu *p1;int i;float sum=0,aver;p1=head;if(p1=NULL)printf(not data!);else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-english; aver=sum/i;printf(English Average:%f,aver);printf(English Sum:%f,sum);/* 统计计算机平均和总分*/void aver_sum_computer().下载可编辑 . stu *p1;int i;float s

25、um=0,aver;p1=head;if(p1=NULL)printf(not data!);else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-computer; aver=sum/i;printf(Computer Average:%f,aver);printf(Computer Sum:%f,sum);/* 统计模块 */void count() int choice;.下载可编辑 .doprintf( *统计学生平均分和总分*n);printf(: 物理平均和总分n);printf(: 数学平均和总分n);printf(: 英语平均和总分n);pr

26、intf(: 计算机平均和总分n);printf( 返回主菜单 :n);printf(请选择 (04):n);scanf(%d,&choice);switch(choice) case 1:aver_sum_physic();break;case 2:aver_sum_mathematic();break;case 3:aver_sum_english();break;case 4:aver_sum_computer();break;case 0:break;while(choice!=0);.下载可编辑 ./* 物理成绩排序*/* 库存排行 */sort_physic()int i=1,j=

27、1;float min;stu *newh,*newp,*tp1,*tp2,*p;newp=newh=NULL;tp1=tp2=NULL;p=head;doi+;p=p-next;while(p-next);while(head!=NULL)p=head;tp1=tp2=p;.下载可编辑 .min=p-physic;while(p-next!=NULL)if(p-next-physicnext-physic;tp1=p;tp2=p-next;p=p-next;if(newh=NULL)newp=newh=tp2;elsenewp-next=tp2;newp=tp2;if(tp2=head)he

28、ad=tp2-next;elsetp1-next=tp2-next;tp2-next=NULL;.下载可编辑 .head=newh;p=head;for(j=1;jname,p-sex,p-num,p-physic);p=p-next;else break;printf(n按任意键返回n);getch();.下载可编辑 ./* 删除相关数据*/shanchu() int num; stu *p,*p0; p=head; cin(p);printf( 请输入要删除的学号 :); scanf(%d,&num); head=p-next; free(p);return 1;p0=p-next;whi

29、le(p0!=NULL)if(p0-num=num)p-next=p;free(p0);.下载可编辑 .return 1;p=p0;p0=p0-next;return 0;/* 修改模块 */void revise_message(stu *h)int choice,revise_num,flag;stu *p;p=head;do.下载可编辑 .printf(n输入要修改的学生的学号:);scanf(%d,&revise_num);while(p-num!=revise_num)p=p-next;/* 查找 */if(p-num=revise_num)printf(n- 学生信息 -n);pr

30、intf(-n);printf( 学号 - 姓名 - 性别 - 物理成绩 - 数学成绩 - 英语成绩 - 计算机成绩n);printf(%8s%4d%8s%8f%8f%8f%8fn,p-name,p-num,p-sex,p-physic,p-mathematic,p-english,p-computer);printf(n您要修改哪一项?n);printf(n1、姓名 n);printf(n2、学号 n);printf(n3、性别 n);.下载可编辑 .printf(n4物理成绩 n);printf(n5、数学成绩 n);printf(n6、英语成绩 n);printf(n7、计算机成绩 n)

31、;printf(n请选择 ( 1-7 ) :);scanf(%d,&choice);switch(choice)case 1:printf(n输入修改后的学生姓名:);scanf(%s,p-name);break;case 2:printf(n输入修改后的学生学号:);scanf(%d,p-num);break;case 3:printf(n输入修改后的性别:);scanf(%s,&p-sex);case 4:printf(n输入修改后的物理成绩:);scanf(%f,&p-physic);case 5:printf(n输入修改后的数学成绩:);scanf(%f,&p-mathematic);

32、case 6:printf(n输入修改后的英语成绩:);scanf(%f,&p-english);break;case 7:printf(n输入修改后的计算机成绩:);scanf(%f,&p-computer);break;.下载可编辑 .printf(-n);printf( 学号 - 姓名 - 性别 - 物理成绩 - 数学成绩 - 英语成绩 - 计算机成绩n);printf(%8s%4d%8s%8f%8f%8f%8fn,p-name,p-num,p-sex,p-physic,p-mathematic,p-english,p-computer);break;if(p-next=NULL)pri

33、ntf(n该学生不存在!);printf(nn要继续吗 ?(y/n);choice=getch();.下载可编辑 .if(choice=y)|(choice=Y)printf(n继续 !n);flag=1;else flag=0;while(flag=1);printf(n按任意键返回主菜单!n);/* 更新模块 */void renew_message() int choice;do printf(nn* 更新学生信息 *nn);printf(1.添加信息 nn);printf(2.删除信息 nn);printf(3.修改信息 nn);printf(4.返回主菜单 nn);printf(请选

34、择 ( 03 ) :);scanf(%d,&choice);switch(choice).下载可编辑 . case 1: insert();break;case 2: shanchu();break;case 3: revise_message(head);break;case 0:;break;while(choice!=0);/* 保留数据函数*/void save(stu *p2) FILE *fp; char file10;printf(Enter file name);scanf(%s,file);fp=fopen(file,w);while(p2!=NULL)fprintf(fp,

35、%s,p2-name);fprintf(fp,%d,p2-num);fprintf(fp,%s,p2-sex);fprintf(fp,%f,p2-physic);.下载可编辑 .fprintf(fp,%f,p2-mathematic);fprintf(fp,%f,p2-english);fprintf(fp,%f,p2-computer);p2=p2-next;fclose(fp);/* 主函数 */char password7=123456;void main()/* 初始化 */char choices;stu *p2;char s8;.下载可编辑 .int flag=0,i;/* 标志项 */int n=3;sum=read_message();doprintf(Enter password:n);scanf(%s,s);if(!strcmp(s,password) printf(PASSnnn); flag=1;break;elseprintf( Error Enter againn);n-;while(n0);if(!flag) printf(You have E

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!