diff --git a/T4insert.cpp b/T4insert.cpp new file mode 100644 index 0000000..0a236ae --- /dev/null +++ b/T4insert.cpp @@ -0,0 +1,52 @@ +²εΘλ +#include +int main() +{ + struct stud + { + int num; + int clas; + float math; + float phy; + float eng; + }t={}; + struct stud stu[100]; + stu[0]={10001,11,99.5,88.5,89.5}; + stu[1]={10002,12,77.9,56.5,87.5}; + stu[2]={10003,11,92.5,99.0,60.5}; + scanf("%d %d %f %f %f",&stu[3].num,&stu[3].clas,&stu[3].math,&stu[3].phy,&stu[3].eng); + int i,j; + for(i=0;stu[i+2].num!=0;i++) + { + if(stu[3].num==stu[i].num)stu[3]=t; + } + 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].num>stu[j].num) + { + 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