版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实验9 二维字符数组-学生成绩管理系统V2.0实验目的:1. 熟悉二维字符数组数组作函数参数, 2. 掌握字符串处理函数及模块化程序设计方法 实验题目:某班有最多不超过30人(具体人数由键盘输入)参加某门课程的考试,用一维数组 编程实现如下学生成绩管理:1. 录入每个学生的学号、姓名和考试成绩; 2. 计算课程的总分和平均分; 3. 按成绩由高到低排出名次表; 4. 按姓名的字典顺序输出成绩表; 5. 按姓名查询学生排名及其考试成绩; #include#define N 30#include#include void main()int n,i;long number40;char name3
2、020;float score20; void input(long number40,char name3020,float score20,int n); void sa(float score20,int n); void sb(long number40,char name3020,float score20,int n); void sc(long number40,char name3020,float score20,int n); void sd(long number40,char name3020,float score20,int n);printf(请输入学生人数(小于
3、30人):);scanf(%d,&n); input(number,name,score,n);printf(*n);for(i=0;in;i+)printf(第%d位学生的学号为:%ld,姓名为:%s,成绩为:%fn,i+1,numberi,namei,scorei);printf(*n);printf(课程的总分和平均分:n); sa(score,n);printf(*n);printf(成绩由高到低排序:n); sb(number,name,score,n); printf(*n); sc(number,name,score,n); printf(*n); sd(number,name,
4、score,n);void input(long number40,char name3020,float score20,int n)int i;for(i=0;in;i+)printf(请输入第%d位学生的学号:,i+1);scanf(%ld,&numberi); printf(请输入第%d位学生的姓名:,i+1); scanf(%s,&namei); printf(请输入第%d位学生的成绩:,i+1); scanf(%f,&scorei);void sa(float score20,int n)int i;float sum=0;for(i=0;in;i+) sum=sum+scorei
5、;printf(学生的总成绩为:%fn,sum);printf(学生的平均成绩为:%fn,sum/n);void sb(long number40,char name3020,float score20,int n) int i,j; char temp20; float temp1; long temp2;for(i=1;in;i+) for(j=0;jn-i;j+) if(scorejscorej+1) temp1=scorej; scorej=scorej+1; scorej+1=temp1; strcpy(temp,namej); strcpy(namej,namej+1); strc
6、py(namej+1,temp); temp2=numberj; numberj=numberj+1; numberj+1=temp2; for(i=0;in;i+) printf(成绩第%d名学号:%ld,姓名:%s,成绩为:%fn,i+1,numberi,namei,scorei);void sc(long number40,char name3020,float score20,int n)int i,j; char temp20; float temp1; long temp2; for(i=0;in;i+)for(j=i+1;jn;j+) if(strcmp(namej,namej-
7、1)0) temp1=scorej; scorej=scorej-1; scorej-1=temp1; strcpy(temp,namej); strcpy(namej,namej-1); strcpy(namej-1,temp); temp2=numberj; numberj=numberj-1; numberj-1=temp2; printf(按姓名的字典顺序输出的结果为:n); for(i=0;in;i+) printf(第%d位学生的学号:%ld,姓名:%s,成绩为:%fn,i+1,numberi,namei,scorei);void sd(long number40,char name3020,float score20,int n)int i;char sname20; void sb(long number40,char name3020,float score20,int n);printf(请输入要查询的学生姓名:);scanf
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年孟连傣族拉祜族佤族自治县医疗事业单位人员招聘考试模拟试题及答案解析
- 2026年静乐县社区工作者招聘考试备考试题及答案解析
- 2026年平罗县医疗事业单位人员招聘笔试模拟试题及答案解析
- 2026年五原县社区工作者招聘考试备考试题及答案解析
- 2026年绿春县社区工作者招聘笔试备考题库及答案解析
- 2026年芮城县医疗事业单位人员招聘笔试备考试题及答案解析
- 2026年来安县医疗事业单位人员招聘笔试参考题库及答案解析
- 2026年无极县医疗事业单位人员招聘考试参考题库及答案解析
- 2026年阳原县医疗事业单位人员招聘考试备考题库及答案解析
- 2026年克东县医疗事业单位人员招聘笔试备考题库及答案解析
- 2026年甘肃省兰州新区产投资本控股集团有限公司招聘考试备考试题及答案详解
- 2026年甘肃省员额检察官遴选考试真题及答案
- 2026年秋季小学道德与法治六年级上册(新教材)教学计划附教学进度表
- 2026及未来5年中国PBT塑胶原料数据监测研究报告
- 2026年秋季西师大版小学一年级上册数学教学计划
- 新版2025-2026部编人教版小学语文1一年级上册(全册)教案设计合集
- 基层医疗卫生机构慢性病健康管理中心建设与服务指南(2026年)
- 2026秋季小学生开学第一课
- (2026秋新版)苏教版六年级数学上册全册教案
- 加油站操作员岗中安全风险考核试卷含答案
- 2026年成考专升本政治时政必考试题及答案
评论
0/150
提交评论