diff --git a/xiangmu3.c b/xiangmu3.c new file mode 100644 index 0000000..566f426 --- /dev/null +++ b/xiangmu3.c @@ -0,0 +1,60 @@ +#include +int main() +{ + printf(" 1.Input\n 2.Output\n 3.Order\n 4.Quit\n"); + + char a; + for(;;) + { + a=getchar(); + switch(a) + { + case'i': printf("Please input info of the three students:\n"); + struct Student + { + int n; + float x; + float y; + float z; + float s; + float w; + }; + int i,j,k; + struct Student stu[3],t; + for(i=0;i<3;i++) + { + scanf("%d%f%f%f",&stu[i].n,&stu[i].x,&stu[i].y,&stu[i].z); + } + stu[0].s=stu[0].x+stu[0].y+stu[0].z; + stu[1].s=stu[1].x+stu[1].y+stu[1].z; + stu[2].s=stu[2].x+stu[2].y+stu[2].z; + stu[0].w=stu[0].s/3; + stu[1].w=stu[1].s/3; + stu[2].w=stu[2].s/3; + for(i=0;i<2;i++) + { + k=i; + for(j=i+1;j<3;j++) + { + if(stu[k].w