From aef857d7c0ff43912cfff7b21fdd19d3ed5016ba Mon Sep 17 00:00:00 2001 From: p6twphb5c <1281646536@qq.com> Date: Mon, 13 Nov 2023 22:02:08 +0800 Subject: [PATCH] ADD file via upload --- E2 step6.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 E2 step6.c diff --git a/E2 step6.c b/E2 step6.c new file mode 100644 index 0000000..7fb461f --- /dev/null +++ b/E2 step6.c @@ -0,0 +1,33 @@ +#include +#include +#define N 3 +struct Student +{char xuehao[10]; + int banji; + char name[20]; + float grade1; + float grade2; + float grade3; +}; +int main() +{struct Student st[N]={{"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 Student a,b; + scanf("%s%d%s%f%f%f",&a.xuehao,&a.banji,a.name,&a.grade1,&a.grade2,&a.grade3); + int i,j,k,l; + for(i=0;ist[l].banji){b=st[j];st[j]=st[l];st[l]=b;}} + printf("%d %s %s %.1f %.1f %.1f\n",st[0].banji,st[0].xuehao,st[0].name,st[0].grade1,st[0].grade2,st[0].grade3); + for(k=1;k