From 9eb431fde4d2caae05e5c2f7143987dcaa91dfad Mon Sep 17 00:00:00 2001 From: pk6gv5h38 <2932140327@qq.com> Date: Sun, 5 Nov 2023 12:15:59 +0800 Subject: [PATCH] ADD file via upload --- 作业2.2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 作业2.2.c diff --git a/作业2.2.c b/作业2.2.c new file mode 100644 index 0000000..72c334e --- /dev/null +++ b/作业2.2.c @@ -0,0 +1,22 @@ +#include +int main() +{int i; + struct Student + { + int num; + float score1; + float score2; + float score3; + float all; + }student1,student2,student3; + + scanf("%d%f%f%f",&student1.num,&student1.score1,&student1.score2,&student1.score3); + scanf("%d%f%f%f",&student2.num,&student2.score1,&student2.score2,&student2.score3); + scanf("%d%f%f%f",&student3.num,&student3.score1,&student3.score2,&student3.score3); + student1.all = student1.score1 + student1.score2 + student1.score3; + student2.all = student2.score1 + student2.score2 + student2.score3; + student3.all = student3.score1 + student3.score2 + student3.score3; + printf("%d %.1f %.1f %.1f %.1f\n",student1.num,student1.score1,student1.score2,student1.score3,student1.all); + printf("%d %.1f %.1f %.1f %.1f\n",student2.num,student2.score1,student2.score2,student2.score3,student2.all); + printf("%d %.1f %.1f %.1f %.1f\n",student3.num,student3.score1,student3.score2,student3.score3,student3.all); +}