学生成绩管理系统v4.0

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

//成绩管理系统v1.0//能动1302王清栋1306030217#includestdio.h#includestdlib.h#defineN30#defineM6voidInput(longnum[],intscore[][M],intn,intm);voidTotalave(intscore[][M],intn,intm);voidevestuTotalave(intscore[][M],intn,intm,longnum[]);voidScoredes(longnum[],intscore[][M],intn,intm);voidScoreas(longnum[],intscore[][M],intn,intm);voidNumas(longnum[],intscore[][M],intn,intm);voidSearch(longnum[],intscore[][M],intn,intx,intm);voidstatistis(longnum[],intscore[][M],intn,intm);voidList(longnum[],intscore[][M],intn,intm);intmain(){intn,score[N][M],c,x,m;longnum[N];printf(输入学生人数);scanf(%d,&n);printf(输入考试科目);scanf(%d,&m);printf(1.Inputrecord\n);printf(2.Caculatetotelandaveragescoreofeverycourse\n);printf(3.Caculatetotelandaveragescoreofeverystudent\n);printf(4.Sortindescendingorderbytotalscoreofeverystudent\n);printf(5.Sortinascendingorderbytotalscoreofeverystudent\n);printf(6.Sortinascendingorderbynumber\n);printf(7.Searchbynumber\n);printf(8.Statisticanalysisforeverycourse\n);printf(9.Listrecord\n);printf(0.Exit\n);printf(Pleaseenteryourchoice:\n);printf(\n);for(;;){scanf(%d,&c);switch(c){case1://录入学生学号和各科成绩Input(num,score,n,m);printf(Pleaseenteryourchoice:\n);break;case2://计算每门课程的总分和平均分Totalave(score,n,m);printf(Pleaseenteryourchoice:\n);break;case3://计算每个学生的总分和平均分evestuTotalave(score,n,m,num);break;case4://按每个学生的总分由高到低排出名次表Scoredes(num,score,n,m);printf(Pleaseenteryourchoice:\n);break;case5://按每个学生的总分由低到高排出名次表Scoreas(num,score,n,m);printf(Pleaseenteryourchoice:\n);break;case6://按学号由小到大排出名次表Numas(num,score,n,m);printf(Pleaseenteryourchoice:\n);break;case7://按学号查询学生排名及其各科成绩printf(请输入查找学号\n);scanf(%d,&x);Search(num,score,n,x,m);printf(Pleaseenteryourchoice:\n);break;case8://成绩分析所占百分比statistis(num,score,n,m);printf(Pleaseenteryourchoice:\n);break;case9://全部输出List(num,score,n,m);Totalave(score,n,m);printf(Pleaseenteryourchoice:\n);break;case0:exit(0);}}return0;}voidInput(longnum[],intscore[][M],intn,intm)//1{inti,j;for(i=0;in;i++){printf(Inputstudent'sIDandscore);scanf(%ld,&num[i]);for(j=0;jm;j++)scanf(%d,&score[i][j]);}}voidTotalave(intscore[][M],intn,intm)//2.计算每门课程的总分和平均分{inti,j,sum[M];doubleave[M];for(j=0;jm;j++){sum[j]=0;for(i=0;in;i++){sum[j]=sum[j]+score[i][j];}ave[j]=(double)sum[j]/n;}for(i=0;im;i++)printf(科目%d的总分=%d,课程的平均分=%f\n,i+1,sum[i],ave[i]);}voidevestuTotalave(intscore[][M],intn,intm,longnum[])//3.计算每个学生的总分和平均分{inti,j,sum[N];doubleave[N];for(i=0;in;i++){sum[i]=0;for(j=0;jm;j++){sum[i]=sum[i]+score[i][j];}ave[i]=(double)sum[i]/m;}for(i=0;in;i++)printf(学号为%ld的总分=%d,其平均分=%f\n,num[i],sum[i],ave[i]);}voidScoredes(longnum[],intscore[][M],intn,intm)//4.按每个学生的总分由高到低排出名次表{inti,j,k,t,h,sum[N];for(i=0;in;i++){sum[i]=0;for(j=0;jm;j++){sum[i]=sum[i]+score[i][j];}}for(i=0;in;i++){k=i;for(j=i+1;jn;j++){if(sum[j]sum[k])k=j;}if(i!=k){t=sum[k],h=num[k];sum[k]=sum[i],num[k]=num[i];sum[i]=t,num[i]=h;}}for(i=0;in;i++)printf(ID:%10ld,score:%d\n,num[i],sum[i]);//以长整形打印用%ld}voidScoreas(longnum[],intscore[][M],intn,intm)//5.按每个学生的总分由di到gao排出名次表{inti,j,k,t,h,sum[N];for(i=0;in;i++){sum[i]=0;for(j=0;jm;j++){sum[i]=sum[i]+score[i][j];}}for(i=0;in;i++){k=i;for(j=i+1;jn;j++){if(sum[j]sum[k])k=j;}if(i!=k){t=sum[k],h=num[k];sum[k]=sum[i],num[k]=num[i];sum[i]=t,num[i]=h;}}for(i=0;in;i++)printf(ID:%10ld,score:%d\n,num[i],sum[i]);//以长整形打印用%ld}voidNumas(longnum[],intscore[][M],intn,intm)//6.按学号由小到大排出名次表{inti,j,k,t[M],h,l;for(i=0;in;i++){k=i;for(j=i+1;jn;j++){if(num[j]num[k])k=j;}if(i!=k){h=num[k];num[k]=num[i];num[i]=h;for(l=0;lm;l++){t[l]=score[k][l];score[k][l]=score[i][l];score[i][l]=t[l];}}}for(i=0;in;i++){printf(ID:%10ld\n,num[i]);//以长整形打印用%ldfor(j=0;jm;j++)printf(project%dscore:%d\n,j+1,score[i][j]);}}voidSearch(longnum[],intscore[][M],intn,intx,intm)//7.按学号查询学生排名及其各科成绩{inthigh=n-1,low=0,mid,c=1,pos,o,find=0,i,j,k,t[M],h,sum[N],l;for(i=0;in;i++){sum[i]=0;for(j=0;jm;j++){sum[i]=sum[i]+score[i][j];}}for(i=0;in;i++){k=i;for(j=i+1;jn;j++){if(num[j]num[k])k=j;}if(i!=k){h=num[k],o=sum[k];num[k]=num[i],sum[k]=sum[i];num[i]=h,sum[i]=o;for(l=0;lm;l++){t[l]=score[k][l];score[k][l]=score[i][l];score[i][l]=t[l];}}}while(find==0&&low=high){mid=(high+low)/2;if(xnum[mid])low=mid+1;elseif(xnum[mid])high=mid-1;else{pos=mid;find=1;}}if(find==0)printf(notfind\n);else{for(i=0;in;i++){if(sum[i]sum[pos])c++;}printf(ID:%10ld\n,num[pos]);//以长整形打印用%ldfor(j=0;jm;j++)printf(project%dscore:%d\n,j+1,score[pos][j]);printf(allscore:%d,order:%d\n,sum[pos],c);}}voidstatistis(longnum[],intscore[][M],intn,intm)//8.{inta=0,b=0,c=0,d=0,e=0,i,j;doubleA,B,C,D,E;for(j=0;jm;j++){for(i=0;in;i++){if(score[i][j]=90)a++;elseif(score[i][j]=80)b++;elseif(score[i][j]=70)c++;elseif(score[i][j]=60)d++;elsee++;}A=(double)a/n*100;B=(double)b/n*100;C=(double)c/n*100;D=(double)d/n*100;E=(double)e/n*100;printf(project%d\n,j+1);printf(优秀人数%d,百分比:%f%%\n,a,A);printf(良好人数%d,百分比:%f%%\n,b,B);printf(中等人数%d,百分比:%f%%\n,c,C);printf(及格人数%d,百分比:%f%%\n,d,D);printf(不及格人数%d,百分比:%f%%\n,e,E);}}voidList(longnum[],intscore[][M],intn,intm){inti,j,sum[N];doubleave[N];for(i=0;

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功