From bfaded97a66edb36ac292b4ad926a144543425d3 Mon Sep 17 00:00:00 2001 From: phf9mvrip <2592369015@qq.com> Date: Sat, 11 Nov 2023 22:41:25 +0800 Subject: [PATCH] ADD file via upload --- T6chang.cpp | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 T6chang.cpp diff --git a/T6chang.cpp b/T6chang.cpp new file mode 100644 index 0000000..e1db9c7 --- /dev/null +++ b/T6chang.cpp @@ -0,0 +1,83 @@ +#include +struct stud + { + int num; + int clas; + char name[10]; + float math; + float phy; + float eng; + char modf; + }; +int main() +{ + + struct stud stu[10]={{10001,11,"Zhang",99.5,88.5,89.5}, + {10002,12,"Yang",77.9,56.5,87.5}, + {10003,11,"Liang",92.5,99.0,60.5}, + }; + struct stud t={}; + struct stud ch[1]; + scanf("%d %d %s %f %f %f",&ch[0].num,&ch[0].clas,ch[0].name,&ch[0].math,&ch[0].phy,&ch[0].eng); + struct stud*p=stu; + struct stud*p1=ch; + void change(struct stud stu[],struct stud ch[]); + change(p,p1); + int i,j; + for(i=0;stu[i].num!=0;i++) + { + if(stu[i+1].num!=0) + { + for(j=i+1;stu[j].num!=0;j++) + { + if(stu[i].clas>stu[j].clas) + { + t=stu[i];stu[i]=stu[j];stu[j]=t; + } + } + } + } + for(i=0;stu[i].num!=0;i++) + { + if(stu[i+1].num!=0) + { + for(j=i+1;stu[j].num!=0&&stu[i].clas==stu[j].clas;j++) + { + if(stu[i].math+stu[i].phy+stu[i].eng