《c语言大作业学生成绩管理系统(共15页).docx》由会员分享,可在线阅读,更多相关《c语言大作业学生成绩管理系统(共15页).docx(15页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上/成绩管理系统v1.0#include #include #include #define N 30#define M 6typedef struct student long studentID; char studentName10; int scoreM;STU;void Input (STU stu,int n,int m);void Totalave (STU stu,int n,int m);void evestuTotalave (STU stu,int n,int m);void Scoredes (STU stu,int n,int m);void
2、Scoreas (STU stu,int n,int m);void Numas (STU stu,int n,int m);void Dicas (STU stu,int n,int m);void Searchbynum (STU stu,int n,int x,int m);void Searchbymane(STU stu,int n,char name,int m);void statistis (STU stu,int n,int m);void List (STU stu,int n,int m);int main() int n,c,x,m; char name10; STU
3、stuN; printf(输入学生人数); scanf(%d,&n); printf(输入考试科目); scanf(%d,&m); printf(1.Input recordn); printf(2.Caculate totel and average score of every coursen); printf(3.Caculate totel and average score of every studentn); printf(4.Sort in descending order by total score of every studentn); printf(5.Sort in
4、ascending order by total score of every studentn); printf(6.Sort in ascending order by numbern); printf(7.Sort in ascending order by name); printf(8.Search by numbern); printf(9.Search by namen); printf(10.Statistic analysis for every coursen); printf(11.List recordn); printf(0.Exitn); printf(Please
5、 enter your choice:n); printf(n); for(;) scanf(%d,&c); switch(c) case 1: /录入学生学号和各科成绩 Input (stu,n,m); printf(Please enter your choice:n); break; case 2: /计算每门课程的总分和平均分 Totalave (stu,n,m); printf(Please enter your choice:n); break; case 3: /计算每个学生的总分和平均分 evestuTotalave (stu,n,m); break; case 4: /按每个
6、学生的总分由高到低排出名次表 Scoredes (stu,n,m); printf(Please enter your choice:n); break; case 5: /按每个学生的总分由低到高排出名次表 Scoreas (stu,n,m); printf(Please enter your choice:n); break; case 6: /按学号由小到大排出名次表 Numas (stu,n,m); printf(Please enter your choice:n); break; case 7: /按姓名的字典顺序排出成绩表 Dicas(stu,n,m); printf(Pleas
7、e enter your choice:n); break; case 8: /按学号查询学生排名及其各科成绩 printf(请输入查找学号n); scanf(%d,&x); Searchbynum(stu,n,x,m); printf(Please enter your choice:n); break; case 9: /按姓名查询学生排名及其各科成绩 printf(请输入查找姓名n); scanf(%s,name); getchar(); Searchbymane(stu,n,name,m); printf(Please enter your choice:n); break; case
8、 10: /成绩分析 所占百分比 statistis (stu,n,m); printf(Please enter your choice:n); break; case 11: /全部输出 List (stu,n,m); Totalave (stu,n,m); printf(Please enter your choice:n); break; case 0: exit(0); return 0;void Input (STU stu,int n,int m) /1 int i,j; for(i=0;in;i+) printf(Input students ID ,name and scor
9、e); scanf(%ld,&stui.studentID); scanf(%s,stui.studentName); for(j=0;jm;j+) scanf(%d,&stui.scorej); void Totalave (STU stu,int n,int m) /2.计算每门课程的总分和平均分 int i,j,sumM; double aveM; for(j=0;jm;j+) sumj=0; for(i=0;in;i+) sumj=sumj+stui.scorej; avej=(double)sumj/n; for(i=0;im;i+) printf(科目%d的总分=%d,课程的平均分
10、=%fn,i+1,sumi,avei);void evestuTotalave (STU stu,int n,int m) /3.计算每个学生的总分和平均分 int i,j,sumN; double aveN; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+stui.scorej; avei=(double)sumi/m; for(i=0;in;i+) printf(学号为%ld,姓名为%s的总分=%d,其平均分=%fn,stui.studentID,stui.studentName,sumi,avei);void Scoredes (STU
11、stu,int n,int m) /4.按每个学生的总分由高到低排出名次表 int i,j,k,h,sumN; STU t; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+stui.scorej; for(i=0;in;i+) k=i; for(j=i+1;jsumk) k=j; if(i!=k) t=stui,h=sumi; stui=stuk,sumi=sumk; stuk=t,sumk=h; for(i=0;in;i+) printf(ID:%10ld,name:%s,score:%dn,stui.studentID,stui.stude
12、ntName,sumi);/以长整形打印用%ldvoid Scoreas (STU stu,int n,int m) /5.按每个学生的总分由di到gao排出名次表 int i,j,k,h,sumN; STU t; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+stui.scorej; for(i=0;in;i+) k=i; for(j=i+1;jn;j+) if (sumjsumk) k=j; if(i!=k) t=stui,h=sumi; stui=stuk,sumi=sumk; stuk=t,sumk=h; for(i=0;in;i+)
13、printf(ID:%10ld,name:%s,score:%dn,stui.studentID,stui.studentName,sumi);/以长整形打印用%ldvoid Numas (STU stu,int n,int m) /6.按学号由小到大排出名次表 int i,j,k; STU t; for(i=0;in;i+) k=i; for(j=i+1;jn;j+) if (stuj.studentIDstuk.studentID) k=j; if(i!=k) t=stuk,stuk=stui,stui=t; for(i=0;in;i+) printf(ID:%10ld,name:%sn,
14、stui.studentID,stui.studentName);/以长整形打印用%ld for(j=0;jm;j+) printf(project %d score:%dn,j+1,stui.scorej); void Dicas (STU stu,int n,int m) /7. int i,j; STU t; for(i=0;in;i+) for(j=i+1;j0) t=stui,stui=stuj,stuj=t; for(i=0;in;i+) printf(ID:%10ld,name:%sn,stui.studentID,stui.studentName); for(j=0;jm;j+
15、) printf(project:%d,score:%dn,j+1,stui.scorej); void Searchbynum (STU stu,int n,int x,int m) /8.按学号查询学生排名及其各科成绩 int i,j,c=1,find=0,sumN; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+stui.scorej; for(i=0;in;i+) if(stui.studentID=x) find=1; break; if(find=0) printf(not findn); else for(j=0;jsumi) c
16、+; printf(ID:%10ld name:%sn,stui.studentID,stui.studentName);/以长整形打印用%ld for(j=0;jm;j+) printf(project %d score:%dn,j+1,stui.scorej); printf(all score: %d,order:%dn,sumi,c); void Searchbymane(STU stu,int n,char name,int m) /9 int i,j,c=1,find=0,sumN; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+s
17、tui.scorej; for(i=0;in;i+) if(strcmp(stui.studentName,name)=0) find=1; break; if(find=0) printf(not findn); else for(j=0;jsumi) c+; printf(ID:%10ld,name:%sn,stui.studentID,stui.studentName);/以长整形打印用%ld for(j=0;jm;j+) printf(project %d score:%dn,j+1,stui.scorej); printf(all score: %d,order:%dn,sumi,c
18、); void statistis (STU stu,int n,int m) /10. int a=0,b=0,c=0,d=0,e=0,i,j; double A,B,C,D,E; for(j=0;jm;j+) for(i=0;i=90) a+; else if(stui.scorej=80) b+; else if(stui.scorej=70) c+; else if(stui.scorej=60) d+; else e+; A=(double)a/n*100; B=(double)b/n*100; C=(double)c/n*100; D=(double)d/n*100; E=(dou
19、ble)e/n*100; printf(project %dn,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); void List (STU stu,int n,int m) /11. int i,j,sumN; double aveN; for(i=0;in;i+) sumi=0; for(j=0;jm;j+) sumi=sumi+stui.scorej; avei=(double)sumi/m; for(i=0;in;i+) printf(ID:%10ld,name:%sn,stui.studentID,stui.studentName); for(j=0;jm;j+) printf(score:%dn,stui.scorej); printf(总分=%dn平均分%fn,sumi,avei); 专心-专注-专业