From e49ae6eb79a7956d7ada7801e2c483341738fc0b Mon Sep 17 00:00:00 2001 From: Cx330 <2011690092@qq.com> Date: Mon, 24 Apr 2023 10:04:54 +0800 Subject: [PATCH] Cx330_AverSumofEveryStudent --- AverSumofEveryStudent.svg | 118 ++++++++++++++++++++++++++++++++++++++ README.md | 7 +++ 2 files changed, 125 insertions(+) create mode 100644 AverSumofEveryStudent.svg diff --git a/AverSumofEveryStudent.svg b/AverSumofEveryStudent.svg new file mode 100644 index 0000000..11241b9 --- /dev/null +++ b/AverSumofEveryStudent.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + AverSumofEveryStudent + (Integer n, Integer m) + + + + + + End + + + + + + + + + + + + + Integer i + + + + + + + + Integer j + + + + + + + + + + + + + + + + + + stu[i].sum = 0 + + + + + + + + + + + stu[i].sum = stu[i].sum+stu + [i].score[j] + + + + + + j = 0 to m-1 + + + + Next + + + Done + + + + + + stu[i].aver = stu[i].sum/m + + + + + + Output "student %d: sum = + %.0f,aver = %.0f\n", i + 1, + stu[i].sum, stu[i].aver + + + + + + + i = 0 to n-1 + + + + Next + + + Done + + + + + diff --git a/README.md b/README.md index 2732667..41341ba 100644 --- a/README.md +++ b/README.md @@ -420,6 +420,13 @@ Step 2:利用循环,输入学生的学号,成绩和各科成绩 #### AverSumofEveryStudent +Step 1:利用for循环给 sum 赋初值为 0 +Step 2:利用第二重循环重新计算每个学生的总分 +Step 3:计算每个学生的平均分 +Step 4:将结果按照舒徐,总分和平均分的顺序进行输出 + +![计算每个学生各门课程的总分和平均分](AverSumofEveryStudent.svg) + #### AverSumofEveryCourse #### SortbyScore