From 70cbd02ddb9c2eecc2a4077b4799a3fd25ce274d Mon Sep 17 00:00:00 2001 From: zhangyu <387881603@qq.com> Date: Tue, 25 Apr 2023 16:54:06 +0800 Subject: [PATCH] ZY-WritetoFile --- -WritetoFile.svg | 150 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 5 ++ 2 files changed, 155 insertions(+) create mode 100644 -WritetoFile.svg diff --git a/-WritetoFile.svg b/-WritetoFile.svg new file mode 100644 index 0000000..d63453d --- /dev/null +++ b/-WritetoFile.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + WritetoFile + + + + + + End + + + + + + + + + + + + + + + + + Integer i + + + + + + + + Integer j + + + + + + + + + + + + + (fp = fopen("student.txt", + "w")) == NULL + + + + + + Output "Failure to open + score.txt!\n" + + + + + + + True + + + False + + + + + + Output fp, "%d\t%d\n", n, m + + + + + + + + + + + + + + + + Output fp, "%10ld%10s", stu + [i].num, stu[i].name + + + + + + + + + + + Output fp, "%10.0f", stu[i]. + score[j] + + + + + + j = 0 to m-1 + + + + Next + + + Done + + + + + + Output fp, "%10.0f%10.0f\ + n", stu[i].sum, stu[i].aver + + + + + + + i = 0 to n-1 + + + + Next + + + Done + + + + + diff --git a/README.md b/README.md index 7432188..4ad36b8 100644 --- a/README.md +++ b/README.md @@ -450,7 +450,12 @@ Step 3:输出学生的总分数和平均分 ![打印学生成绩](PrintScore.svg) #### WritetoFile +Step 1:读取文件输出学生人数和课程门数 +Step 2:利用循环for依次输出学生学号和姓名 +Step 3:利用二次循环输出学生成绩 +Step 4:输出总成绩和平均分 +![输出n个学生的学号,姓名以及m门课程的成绩](WritetoFile.svg) #### ReadfromFile #### exit