From 9add454216dfc1553d8b39a2fdf7895fcbcd48e3 Mon Sep 17 00:00:00 2001 From: pv7g39eqr <2500187549@qq.com> Date: Sun, 12 Nov 2023 19:08:14 +0800 Subject: [PATCH] ADD file via upload --- xiangmu2.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 xiangmu2.c diff --git a/xiangmu2.c b/xiangmu2.c new file mode 100644 index 0000000..67d7a79 --- /dev/null +++ b/xiangmu2.c @@ -0,0 +1,24 @@ +#include +struct Student + { + int num; + float a; + float b; + float c; + float d; + } ; +int main() +{ int i,j; + struct Student stu[3]; + for(i=0;i<3;i++) + { + scanf("%d%f%f%f",&stu[i].num,&stu[i].a,&stu[i].b,&stu[i].c); + } + stu[0].d=stu[0].a+stu[0].b+stu[0].c; + stu[1].d=stu[1].a+stu[1].b+stu[1].c; + stu[2].d=stu[2].a+stu[2].b+stu[2].c; + for(j=0;j<3;j++) + { + printf("学号 %d 高数成绩 %.1f 大学物理成绩 %.1f 英语成绩 %.1f 总成绩 %.1f\n",stu[j].num,stu[j].a,stu[j].b,stu[j].c,stu[j].d); + } +}