|
|
|
|
#include<stdio.h>
|
|
|
|
|
int main(){int i,m,n,v;
|
|
|
|
|
int j;
|
|
|
|
|
int k;
|
|
|
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
struct student{
|
|
|
|
|
int stuNum;
|
|
|
|
|
int classNum;
|
|
|
|
|
float score[3];
|
|
|
|
|
float sum;
|
|
|
|
|
}stu[4]={{
|
|
|
|
|
10001,11,99.5,88.5,89.5
|
|
|
|
|
},{
|
|
|
|
|
10002,12,77.9,56.5,87.5
|
|
|
|
|
},{
|
|
|
|
|
10003,11,92.5,99.0,60.5
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD>
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d", &stu[3].stuNum);k=stu[3].stuNum;for(i=0;i<3;i++){
|
|
|
|
|
if(k==stu[i].stuNum){ printf("ѧ<EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ϢΪ\n %d %d %.1f %.1f %.1f", stu[i].stuNum, stu[i].classNum, stu[i].score[0], stu[i].score[1], stu[i].score[2]);
|
|
|
|
|
return 0;}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>༶<EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d", &stu[3].classNum);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>Ƴɼ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
for(m=0;m<3;m++){
|
|
|
|
|
scanf("%f", &stu[3].score[m]);
|
|
|
|
|
stu[3].sum+=stu[3].score[m];
|
|
|
|
|
}
|
|
|
|
|
// <09><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(n=1;n<4;n++){
|
|
|
|
|
for(j=n;j>0;j--){
|
|
|
|
|
// <09>ȶ༶<D4B0><E0BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD><D9B6>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(stu[j].classNum<stu[j-1].classNum){
|
|
|
|
|
struct student temp = stu[j];
|
|
|
|
|
stu[j] = stu[j-1];
|
|
|
|
|
stu[j-1] = temp;
|
|
|
|
|
}//<2F>༶<EFBFBD><E0BCB6>ͬ<EFBFBD><CDAC><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD>ɸߵ<C9B8><DFB5><EFBFBD>
|
|
|
|
|
else if(stu[j].classNum==stu[j-1].classNum&&stu[j].sum>stu[j-1].sum){
|
|
|
|
|
struct student temp = stu[j];
|
|
|
|
|
stu[j] = stu[j-1];
|
|
|
|
|
stu[j-1] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(v=0;v<4;v++){
|
|
|
|
|
printf("\n%d %d %.1f %.1f %.1f", stu[v].stuNum, stu[v].classNum, stu[v].score[0], stu[v].score[1], stu[v].score[2]);
|
|
|
|
|
|
|
|
|
|
if(stu[v].stuNum==k)printf(" inserted");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|