From fa5c4d5347205965875e65b959df8c4847b5b499 Mon Sep 17 00:00:00 2001 From: xuzigui <3542624849@qq.com> Date: Tue, 25 Apr 2023 16:35:32 +0800 Subject: [PATCH] =?UTF-8?q?XZG=5FAsScotbyNum=E6=B5=81=E7=A8=8B=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsSortbyNum.svg | 239 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 6 ++ 2 files changed, 245 insertions(+) create mode 100644 AsSortbyNum.svg diff --git a/AsSortbyNum.svg b/AsSortbyNum.svg new file mode 100644 index 0000000..3e14329 --- /dev/null +++ b/AsSortbyNum.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + AsSortbyNum + + + + + + End + + + + + + + + + + + + + + + + + Integer i + + + + + + + + Integer j + + + + + + + + Integer k + + + + + + + + Integer t + + + + + + + + + + + + + + + + k = i + + + + + + + + + + + + + + + + + + if (stu[j].num < stu[k].num) + + + + + + k = j + + + + + + + True + + + False + + + + + + j = i+1 to n-1 + + + + Next + + + Done + + + + + + + + + + + + + k != i + + + + + + + + + + + + + + + + + + + + + + SwapFloat(&stu[k].score[t], & + stu[i].score[t]) + + + + + + t = 0 to m-1 + + + + Next + + + Done + + + + + + + + SwapFloat(&stu[k].sum, &stu[i]. + sum) + + + + + + + + SwapFloat(&stu[k].aver, &stu[i]. + aver) + + + + + + + + SwapLong(&stu[k].num, &stu[i]. + num) + + + + + + + + SwapChar(stu[k].name, stu + [i].name) + + + + + + + + True + + + False + + + + + + + i = 0 to n-2 + + + + Next + + + Done + + + + + diff --git a/README.md b/README.md index 41341ba..5bf68ba 100644 --- a/README.md +++ b/README.md @@ -435,6 +435,12 @@ Step 4:将结果按照舒徐,总分和平均分的顺序进行输出 #### AsSortbyNum +step 1:利用循环将i赋值给k +step 2:用循环从i+1到n-1比较,将较小的学号赋给k +step 3:如果k与i不相等,每一课的成绩交换 +step 4:总分,平均分,学号,姓名依次交换 + +![按选择法将数组 num 的元素从低到高排序](AsScortNum.svg) #### SortbyName #### SearchbyNum