#include<cstdio> #include<cstring> int n,m,w; struct Student { char name[20]; int mingci; int score; }; struct Xiangmu { int bianhao; char xiangname[20]; Student students[50]; int xiangscore; }; struct School { char xiaoname[20]; int renshu; int Sumnamtuan; int Sumnvtuan; int sumtuan; int sumnanscore; int sumnvscore; Xiangmu SuoyouXiangmu[50]; }xuexiao[50]; void shuruchengji(int i) { int qumingcishu = ( (i&1)==1?5:3 ); printf("请输入项目%d的信息\n本项目统计前%d名成绩\n",i,qumingcishu); printf("按名次顺序输入运动员姓名,校名(数字编号),成绩,\n"); char sss[20];int xiaohao,defen; int j=1; for(;j<=qumingcishu;j++){ scanf("%s%d%d",sss,&xiaohao,&defen); xuexiao[xiaohao].SuoyouXiangmu[i].students[j].mingci=j; strcpy(xuexiao[xiaohao].SuoyouXiangmu[i].students[j].name,sss); xuexiao[xiaohao].SuoyouXiangmu[i].students[j].score=defen; } } void shuchuxiangchengjidan(int k) { printf("%d校的成绩单\n",k); for(int i=1;i<=m+w;i++){ printf("项目%d的成绩单为\n",i); for(int j=1;j<=5;j++){ if(xuexiao[k].SuoyouXiangmu[i].students[j].mingci!=0){ printf("名次%d名字%s得分%d\n", xuexiao[k].SuoyouXiangmu[i].students[j].mingci, xuexiao[k].SuoyouXiangmu[i].students[j].name, xuexiao[k].SuoyouXiangmu[i].students[j].score); if(i<=m){ xuexiao[k].Sumnamtuan+=xuexiao[k].SuoyouXiangmu[i].students[j].score; } else xuexiao[k].Sumnvtuan+=xuexiao[k].SuoyouXiangmu[i].students[j].score; } } } } void shuchutuantibiao(int k) { printf("\n\n%d校团体总分报表\n",k); printf("男团%d\n",xuexiao[k].Sumnamtuan); printf("女团%d\n",xuexiao[k].Sumnvtuan); printf("总团%d\n",xuexiao[k].Sumnvtuan+xuexiao[k].Sumnamtuan); } int main() { int nanzirenshu,nvzirenshu; printf("输入n\n");scanf("%d",&n); printf("输入m\n");scanf("%d",&m); printf("输入w\n");scanf("%d",&w); for(int i=1;i<=m+w;i++) shuruchengji(i); for(int i=1;i<=n;i++) shuchuxiangchengjidan(i); for(int i=1;i<=n;i++) shuchutuantibiao(i); return 0; }
时间: 2024-11-10 03:59:46