From 75231e30485834f42b1877389be2d11c2427072c Mon Sep 17 00:00:00 2001 From: xuzilin <2849252603@qq.com> Date: Sat, 15 Apr 2023 16:18:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?XZL=5F=E8=BE=93=E5=87=BAn=E4=B8=AA=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E7=9A=84=E5=AD=A6=E5=8F=B7=E3=80=81=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E5=8F=8Am=E9=97=A8=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E5=88=B0=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index ecbd711..25f8f1d 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,25 @@ void PrintScore(STU stu[],int n,int m) ``` void WritetoFile(STU stu[],int n,int m) { + FILE *fp; + int i, j; + if((fp = fopen("student.txt","w")) == NULL) + { + printf("Failure to open score.txt!\n"); + exit(0); + } + fprintf(fp, "%d\t%d\n", n, m); //将学生人数和课程门数写入文件 + for (i=0; i Date: Sat, 15 Apr 2023 16:41:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?XZL=5F=E8=BE=93=E5=87=BAn=E4=B8=AA=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E7=9A=84=E5=AD=A6=E5=8F=B7=E3=80=81=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E5=8F=8Am=E9=97=A8=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E5=88=B0=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25f8f1d..70b55fe 100644 --- a/README.md +++ b/README.md @@ -323,7 +323,7 @@ void WritetoFile(STU stu[],int n,int m) { fprintf(fp, "%10.0f", stu[i].score[j]); } - fprintf(fp, "10.0f%10.0f\n", stu[i].sum, stu[i].aver); + fprintf(fp, "%10.0f%10.0f\n", stu[i].sum, stu[i].aver); } fclose(fp); }