学生运动会分数记录系统
2013-01-24 19:03
267 查看
今天拉了一天肚子,快虚脱了,还要忙着复习最后两科,(明天考完就解放了,O(∩_∩)O哈哈~)。只写了分数记录系统输入函数,明天考完试后再添加输出和注释。
代码如下:
2013-01-24 19:03:37
2013-02-25 16:20:33
放完寒假回来了,以后仍然会每天学一点。
代码如下:
#include"iostream" using namespace std; #include<string> #include<fstream> #include<iomanip> struct school { string name; int number; int sores; int male; int female; }sch[25]; struct { string name[5]; int xuhao[5]; }stu[25]; struct { int pre[5]; }pro[25]; int fen1[5]={7,5,3,2,1},fen2[3]={5,3,1}; int n,m,w,x,i,j; void input() { cout<<"请输入参与学校个数"<<endl; cin>>n; cout<<"请输入学校的名字"<<endl; for(i=1;i<=n;i++) { cin>>sch[i].name; sch[i].number=i; sch[i].sores=0; sch[i].male=0; sch[i].female=0; } cout<<"请分别输入男子项目个数和女子项目个数"<<endl; cin>>m>>w; for(i=1;i<=m+w;i++) { if(i%2) { cout<<"请输入第"<<i<<"个项目前五名学校的序号"<<endl; for(j=1;j<=5;j++) { cin>>x; pro[i].pre[j]=x; sch[x].sores+=fen1[j-1]; if(i<=m) sch[x].male+=fen1[j-1]; else sch[x].female+=fen1[j-1]; } } else { cout<<"请输入第"<<i<<"个项目前三名学校的序号"<<endl; for(j=1;j<=3;j++) { cin>>x; pro[i].pre[j]=x; sch[x].sores+=fen2[j-1]; if(i<m) sch[x].male+=fen2[j-1]; else sch[x].female+=fen2[j-1]; } } } } void print(int i) { cout<<sch[i].number<<setw(10)<<sch[i].name<<setw(10)<<sch[i].sores<<setw(10)<<sch[i].male<<setw(10)<<sch[i].female<<endl; } void sore()// 按总成绩排名输出 { cout<<"按总成绩排名输出"<<endl; school temp; for(i=1;i<=n;i++) { int flag=1; for(j=1;j<=n-i;j++) { if(sch[j].sores<sch[j+1].sores) { temp=sch[j]; sch[j]=sch[j+1]; sch[j+1]=temp; flag=0; } } if(1==flag) break; } for(i=1;i<=n;i++) print(i); } void malesore() { cout<<"按男子总成绩排名输出"<<endl; school temp; for(i=1;i<=n;i++) { int flag=1; for(j=1;j<=n-i;j++) { if(sch[j].male<sch[j+1].male) { temp=sch[j]; sch[j]=sch[j+1]; sch[j+1]=temp; flag=0; } } if(flag==1) break; } for(i=1;i<=n;i++) print(i); } void femalesore() { cout<<"按女子总成绩排名输出"<<endl; school temp; for(i=1;i<=n;i++) { int flag=1; for(j=1;j<=n-i;j++) { if(sch[j].female<sch[j+1].female) { temp=sch[j]; sch[j]=sch[j+1]; sch[j+1]=temp; flag=0; } } if(flag==1) break; } for(i=1;i<=n;i++) print(i); } int main() { input(); sore(); malesore(); femalesore(); return 0; }
2013-01-24 19:03:37
2013-02-25 16:20:33
放完寒假回来了,以后仍然会每天学一点。
相关文章推荐
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- MySQL分组查询获取每个学生前n条分数记录(分组查询前n条记录)
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- sql server 取每一个学生多个科目当中分数最高的记录……
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 学生运动会报名系统
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 学生信息管理系统之删除记录
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 学生信息综合管理系统开发记录(数据库课程设计)
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 运动会分数统计系统——史上最完善的运动会分数统计系统
- javaWeb学习记录:学生信息管理系统
- 机房收费系统——学生充值记录
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG
- 记录:做Hibernate+Struts2学生管理系统遇到的BUG