版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、程序说明:有N个学生,每个学生的数据包含学号(不重复)、姓名、三门课的成绩及平均 成绩,试设计一学生成绩管理系统,使之能提供以下功能:(1)主菜单 学生成绩管理系统1、成绩录入2、成绩查询3、成绩统计4、退 出(2)各菜单项功能成绩录入:输入学生的学号、姓名及三门课的成绩;成绩查询:(至少一种查询方式)v按学号查询学生记录。v查询不及格学生的记录。成绩统计:v计算学生的平均分;v根据学生的平均分高低,对学生的数据进行排序后输出;v对学生单科成绩排序,输出学生姓名与该科成绩;退出系统:退出整个系统(即主菜单)。(3)结构体数组:# define N 30 struct student int n
2、um; /*定义学号 */char name20; /*定义姓名*/float score3; /*定义存贮三门课成绩的数组*/float average; /*定义平均成绩*/;struct stude nt stuN;/* 定义结构体数组,存贮多个学生的记录*/.#in clude<stdio.h>#in clude<stdlib.h>#in clude<stri ng.h>struct student int num; char name20;float score4;float average;stu10000;long t,max;bool unp
3、ass1000;FILE *fstu=fopen("stud.dat","at+");int init()int no,i;float s4,ave;char nam20;while (!feof(fstu)fscan f(fstu,"%d",&no);fscan f(fstu,"%s", nam);IIif (no>max)max =no;stu no . num=no;strcpy(stu no. name, nam);un pass no=false;for (i=1;i<=3;i+)st
4、u no.scorei=si;if (si<60)un pass no=true;stu no .average=ave;int stuinsert()int no,i;float s3,sum;char nam20,cha;n");loop:pri ntf("请输入学生的学号、姓名及三门课的成绩scan f("%d", &n o);sca nf("%s", nam);scan f("%f%f%f/n", &s1, &s2, &s3);if (no>max)max =no
5、;stu no . num=no;sum=0.0;strcpy(stu no, name, nam);un pass no=false;for (i=1;i<=3;i+)stu no .scorei=si;sum=sum+si;if (si<60)un pass no=true;stu no .average=sum/3.0;fprin tf(fstu,"n");fprintf(fstu,"%d %s %f %f %f %fn",stuno.num,,stuno.score1,stuno.s core2,stu no .s
6、core3,stu no .average);int find(int x)long i,no;switch (x)case 1:printf("请输入学号:”);scan f("%d", &no);printf("%d %s %f %f %f %fn”,stuno.num,,stuno.score1,stuno.score2,stu no .score3,stu no average);break;case 2:for (i=1;i<=max;i+) if (unpassi) printf("%d %s %f
7、 %f %f %fn",stui.num,st ui. name,stui.score1,stui.score2,stui.score3,stui.average);break;int sort(int x)extern int headprint(int x);student so1000;int i,j,k,n;switch (x)case 1:for (i=1;i<=max;i+) if (stui.num=i)printf("%d%s %fn",i,,stui.average);break;case 2:n=0;for (i=1;i
8、<=max;i+)j=1; if (stui.num=i)while (soj.average>stui.average)&&(j<=n)j+; n+;for (k=n;k>=j;k-)sok=sok-1; soj=stui;for (i=1;i<=n;i+)printf("%d %s %f %f %f %fn”,soi.num,,soi.score1,soi.score2,soi.sc ore3,soi.average); break; case 3:headprint(4);int othersort(int x)ex
9、tern int headprint(int x);student so1000;int i,j,k,n,q; q=0;switch (x)case 1:if (q=0) q=1;case 2:if (q=0) q=2;case 3:if (q=0) q=3;n=0;for (i=1;i<=max;i+)j=1;if (stui.num=i)while (soj.scoreq>stui.scoreq)&&(j<=n)j+;n+;for (k=n;k>=j;k_)sok=sok-1;soj=stui;for (i=1;i<=n;i+)printf(&
10、quot;%d %s %fn",soi.num,,soi.scoreq);break;int select(int x)extern int headprint(int x);int p;switch (x)case 1:sca nf("%d",&p);switch (p)case 1:stu in sert(); break;case 2:headprint(2); break;case 3:headprint(3);break;case 4:t=0;break;break;case 2:scanf("%d",&
11、;p); fin d(p);break;case 3:scanf("%d",&p);sort(p);break;case 4:scanf("%d",&p); othersort(p);break;int headprint(intx)switch (x) case 1:printf("学生成绩管理系统n");printf("1、成绩录入 n”); printf("2、 成绩查询 n");printf("3、成绩统计 n”);printf("4、退 出 n");select(x);break;case 2:printf("1、按学号查询学生记录n");printf("2、查询不及格学生的记录n");select(x);break;case 3:printf("1、计算学生的平均分n");n");printf("2、根据学生的平均分高低,对学生的数据进行排序后输出n");printf("3、对学生单科成绩排序,输出学生姓名与该科成绩sel
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 行政审批电话回访制度
- 行政审批股考勤制度
- 装修方案审批制度
- 设备检修等作业审批制度
- 滞洪区规划与建设方案
- 光储充电站安全管理方案
- 高速公路施工安全防护方案
- 防火安全教育培训实施方案
- 2025年可以考公务员的面试题库及答案
- 2026年a1a2驾驶考试题答案
- 2026山东济南市中城市发展集团有限公司社会招聘备考题库附答案详解
- 注册会计师战略中ESG战略实施的管理体系
- 2025学年第二学期杭州市高三年级二模教学质量检测数学试卷(含答案)
- 泉州市2026社区工作者招聘考试笔试题库(含答案)解析
- 市政道路工程旁站监理实施细则
- 采购份额管理制度
- 2026年河南工业贸易职业学院单招职业适应性测试模拟卷(附答案)
- 交通安全设施施工安全技术交底记录
- 慢性鼻窦炎临床诊疗指南许庚
- 矿山救护队理论考试重点题库500题(含答案)
- 红色绘本小故事爱国教育-长征路上的红小丫课件
评论
0/150
提交评论