学生成绩管理系统v3.0_第1页
学生成绩管理系统v3.0_第2页
学生成绩管理系统v3.0_第3页
学生成绩管理系统v3.0_第4页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

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

文档简介

1、./ 成绩管理系统 v3.0/能动 1302王清栋 1306030217#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 30void Input (long num,int score,int n,char name10);void Totalave (int score,int n);void Scoredes (long num,int score,int n,char name10);void Scoreas (long num,int score,int n,char

2、 name10);void Numas (long num,int score,int n,char name10);void Nameorder(long num,int score,int n,char name10) ;void Searchbyno (long num,int score,int n,int x,char name10);void Searchbyname(long num,int score,int n,char c,char name10);void statistis (int score,int n);void List (long num,int score,

3、int n,char name10);int main()int n,scoreN,c,x;long numN;char nameN10;char y10;专业资料.printf("输入学生人数 ");scanf("%d",&n);/ getchar();printf("1.Input recordn");printf("2.Caculate totel and average score of every coursen");printf("3.Sort in descending order

4、by scoren");printf("4.Sort in ascending order by score n");printf("5.Sort in ascending order by numbern");printf("6.Sort in dictionary order by namen");printf("7.Search by numbern");printf("8.search by namen");printf("9.Statistic analysisn&

5、quot;);printf("10.List recordn");printf("0.Exitn");printf("Please enter your choice:n");printf("n");for(;)scanf("%d",&c);switch(c)case 1:/ 录入学生学号和各科成绩专业资料.Input (num,score,n,name);printf("Please enter your choice:n");break;case 2:/ 计算每门

6、课程的总分和平均分Totalave (score,n);printf("Please enter your choice:n");break;case 3:/ 按 chengji由高到低排出名次表Scoredes (num,score,n,name);printf("Please enter your choice:n");break;case 4:/ 按 chengji由低到高排出名次表Scoreas (num,score,n,name);printf("Please enter your choice:n");break;case

7、 5:/ 按学号由小到大排出名次表Numas (num,score,n,name);printf("Please enter your choice:n");break;case 6:/ 按学号由小到大排出名次表Nameorder (num,score,n,name);printf("Please enter your choice:n");专业资料.break;case 7:/ 按学号查询学生排名及其各科成绩printf("请输入查找学号n");scanf("%d",&x);Searchbyno (num

8、,score,n,x,name);printf("Please enter your choice:n");break;case 8:/ 按姓名查询学生排名及其各科成绩printf("请输入查找姓名n");getchar();gets(y);Searchbyname (num,score,n,y,name);break;printf("Please enter your choice:n");case 9:/ 成绩分析所占百分比statistis (score,n);printf("Please enter your cho

9、ice:n");break;case 10:/ 全部输出List (num,score,n,name);printf("Please enter your choice:n");break;专业资料.case 0:exit(0);return 0;void Input (long num,int score,int n,char name10)/1int i;for(i=0;i<n;i+)printf("Input student's ID ,name and score");scanf("%ld",&

10、numi);scanf("%s",namei);scanf("%d",&scorei);/getchar();void Totalave (int score,int n)/2. 计算课程的总分和平均分int i,sum=0;double ave;专业资料.for(i=0;i<n;i+)sum=sum+scorei;ave=(double)sum/n;printf("总分 =%d, 课程的平均分 =%fn",sum,ave);void Scoredes (long num,int score,int n,char nam

11、e10)/3. 按学生的分由高到低排出名次表int i,j,k,t,h;char temp10;for(i=0;i<n;i+)k=i;for( j=i+1;j<n;j+)if (scorej>scorek)k=j;if(i!=k)专业资料.t=scorek,h=numk,strcpy(temp,namek);scorek=scorei,numk=numi,strcpy(namek,namei);scorei=t,numi=h,strcpy(namei,temp);for(i=0;i<n;i+)printf("ID:%10ld,name:%s,score:%dn

12、",numi,namei,scorei);/以长整形打印用 %ldvoid Scoreas (long num,int score,int n,char name10)/4. 按学生的分由高到低排出名次表int i,k,t,h,j;char temp10;for(i=0;i<n;i+)k=i;for( j=i+1;j<n;j+)if (scorej<scorek)k=j;专业资料.if(i!=k)t=scorek,h=numk,strcpy(temp,namek);scorek=scorei,numk=numi,strcpy(namek,namei);scorei=

13、t,numi=h,strcpy(namei,temp);for(i=0;i<n;i+)printf("ID:%10ld,name:%s,score:%dn",numi,namei,scorei);/以长整形打印用 %ldvoid Numas (long num,int score,int n,char name10)/5. 按学号由小到大排出名次表int i,k,h,t,j;char temp10;for(i=0;i<n;i+)k=i;for( j=i+1;j<n;j+)if (numj<numk)专业资料.k=j;if(i!=k)t=scorek,

14、h=numk,strcpy(temp,namek);scorek=scorei,numk=numi,strcpy(namek,namei);scorei=t,numi=h,strcpy(namei,temp);for(i=0;i<n;i+)printf("ID:%10ld,name:%s,score:%dn",numi,namei,scorei);/以长整形打印用 %ldvoid Nameorder(long num,int score,int n,char name10)/6 。按姓名的字典顺序排出成绩表int i,k,t,h;char temp10;for(i=0

15、;i<n;i+)专业资料.for(k=i+1;k<n;k+)if(strcmp(namei,namek)>0)t=scorek,h=numk,strcpy(temp,namek);scorek=scorei,numk=numi,strcpy(namek,namei);scorei=t,numi=h,strcpy(namei,temp);for(i=0;i<n;i+)printf("ID:%10ld,name:%s,score:%dn",numi,namei,scorei);/以长整形打印用 %ldvoid Searchbyno (long num,i

16、nt score,int n,int x,char name10)/7. 按学号查询学生排名及考试成绩int high=n-1,low=0,mid,c=1,pos,find=0,i,k,h,j,t;char temp10;for(i=0;i<n;i+)专业资料.k=i;for( j=i+1;j<n;j+)if (numj<numk)k=j;if(i!=k)t=scorek,h=numk,strcpy(temp,namek);scorek=scorei,numk=numi,strcpy(namek,namei);scorei=t,numi=h,strcpy(namei,temp

17、);while(find=0&&low<=high)mid=(high+low)/2;if(x>nummid)low=mid+1;else if(x<nummid)high=mid-1;else专业资料.pos=mid;find=1;if(find=0)printf("not findn");elsefor(i=0;i<n;i+)if(scorei>scorepos)c+;printf("ID:%10ld,name:%s,order:%d,",numpos,namepos,c);/以长整形打印用%ldprin

18、tf("score:%dn",scorepos);void Searchbyname(long num,int score,int n,char c,char name10)/8。按姓名查询学生排名及其考试成绩专业资料.int i,pos=-1,d=1;for(i=0;i<n;i+)if(strcmp(namei,c)=0)pos=i;if(pos=-1)printf("not findn");elsefor(i=0;i<n;i+)if(scorei>scorepos)d+;printf("ID:%10ld,name:%s,order:%d,",numpos,namepos,d);/以长整形打印用%ldprintf("score:%dn",scorepos);void statistis (int score,int n)/9. 案优秀良好中等及格不及格5 个类别,统计每个类别的人数以及所占的百分比int a=0,b=0,c=0,d=0,e=0,i;专业资料.double A,B,C,D,E;for(i=0;i<n;i+)if(scorei>=90)a+;else if(scorei>=80)b+;else if(scorei>=

温馨提示

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

评论

0/150

提交评论