From e477320d211b5855367c6c5a4914733e6f981ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Mon, 24 Apr 2023 22:05:30 +0800 Subject: [PATCH 01/12] * --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index c79c801..48ad77d 100644 --- a/README.md +++ b/README.md @@ -405,3 +405,23 @@ Step 4:否则提示不存在并结束 ### sort_data Step 1:对库存记录按学号从小到大排序 +Step 2:将按照学生成绩排序,若前面的比后面大,则交换 +Step 3:每次遍历记录是否交换,若没有交换,则排序结束 +Step 4:若成绩相同,则按照学号从小到大排序 + + +### make_chart + +Step 1:输入文件名 +Step 2:判断其是否存在 +Step 3:若存在则打开文件并读取CSV 格式保存的所有库存记录 +Step 4:否则给出错误信息并结束 + + +### read_data +Step 1:输入文件名 +Step 2:查看输入的文件名是否和已有的文化相匹配 +Step 3:若匹配成功,则打开文件 +Step 4:若不成功,则返回错误值 +Step 5:打开后利用循环,依次输出文件里各个学生的学号,姓名和成绩; +Step 6:关闭文件 From fbc4740a062674ef762be581414059285e1587b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 17:42:15 +0800 Subject: [PATCH 02/12] 1 --- picture1.drawio | 264 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 picture1.drawio diff --git a/picture1.drawio b/picture1.drawio new file mode 100644 index 0000000..359174b --- /dev/null +++ b/picture1.drawio @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4533b0330728cbb422928ae023650e3a14eccf44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 17:44:17 +0800 Subject: [PATCH 03/12] 1 --- picture1.drawio.svg | 264 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 picture1.drawio.svg diff --git a/picture1.drawio.svg b/picture1.drawio.svg new file mode 100644 index 0000000..359174b --- /dev/null +++ b/picture1.drawio.svg @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8892531498f3879c5e2a02c0346d2e14e7d0d0ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 17:45:40 +0800 Subject: [PATCH 04/12] 1 --- picture1.drawio | 264 --------------- picture1.drawio.svg | 785 +++++++++++++++++++++++++++++--------------- 2 files changed, 521 insertions(+), 528 deletions(-) delete mode 100644 picture1.drawio diff --git a/picture1.drawio b/picture1.drawio deleted file mode 100644 index 359174b..0000000 --- a/picture1.drawio +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/picture1.drawio.svg b/picture1.drawio.svg index 359174b..e6b1f6e 100644 --- a/picture1.drawio.svg +++ b/picture1.drawio.svg @@ -1,264 +1,521 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + +
+
+
+ + main + +
+
+
+
+ + main + +
+
+ + + + + + +
+
+
+ init +
+
+
+
+ + init + +
+
+ + + + + + +
+
+
+ 显示菜单 +
+
+
+
+ + 显示菜单 + +
+
+ + + + + + +
+
+
+ 选择菜单命令 +
+
+
+
+ + 选择菜单命令 + +
+
+ + + + + + + + +
+
+
+ 读取数据 +
+
+
+
+ + 读取数据 + +
+
+ + + + + + + + +
+
+
+ 保存数据 +
+
+
+
+ + 保存数据 + +
+
+ + + + + + + + +
+
+
+ 打印数据 +
+
+
+
+ + 打印数据 + +
+
+ + + + + + + + +
+
+
+ 查询数据 +
+
+
+
+ + 查询数据 + +
+
+ + + + + + + + +
+
+
+ 添加数据 +
+
+
+
+ + 添加数据 + +
+
+ + + + + + + + +
+
+
+ 更新数据 +
+
+
+
+ + 更新数据 + +
+
+ + + + + + + + +
+
+
+ 删除数据 +
+
+
+
+ + 删除数据 + +
+
+ + + + + + + + +
+
+
+ 对数据排序 +
+
+
+
+ + 对数据排序 + +
+
+ + + + + + + + + + +
+
+
+ 生成图表报表 +
+
+
+
+ + 生成图表报表 + +
+
+ + + + + + + + +
+
+
+ 确定退出 +
+
+
+
+ + 确定退出 + +
+
+ + + + + + + +
+
+
+ read_data +
+
+
+
+ + read_data + +
+
+ + + + + + + +
+
+
+ save_data +
+
+
+
+ + save_data + +
+
+ + + + + + + +
+
+
+ print_data +
+
+
+
+ + print_data + +
+
+ + + + + + + +
+
+
+ query_data +
+
+
+
+ + query_data + +
+
+ + + + + + + +
+
+
+ add_data +
+
+
+
+ + add_data + +
+
+ + + + + + + +
+
+
+ update_data +
+
+
+
+ + update_data + +
+
+ + + + + + + +
+
+
+ delete_data +
+
+
+
+ + delete_data + +
+
+ + + + + + + +
+
+
+ sort_data +
+
+
+
+ + sort_data + +
+
+ + + + + + + +
+
+
+ make_data +
+
+
+
+ + make_data + +
+
+ + + + + +
+
+
+ quit +
+
+
+
+ + quit + +
+
+ + + + + + + +
+
+
+ 命令错误,重新选择 +
+
+
+
+ + 命令错误,重新选择 + +
+
+
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file From 77d882eecbc905f84af8329a73f276e2a0986732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 21:47:01 +0800 Subject: [PATCH 05/12] 1 --- picture-add.drawio.svg | 263 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 picture-add.drawio.svg diff --git a/picture-add.drawio.svg b/picture-add.drawio.svg new file mode 100644 index 0000000..f5552c0 --- /dev/null +++ b/picture-add.drawio.svg @@ -0,0 +1,263 @@ + + + + + + + + + +
+
+
+ + add_data + +
+
+
+
+ + add_data + +
+
+ + + + + + + + +
+
+
+ 数据库满? +
+
+
+
+ + 数据库满? + +
+
+ + + + + + +
+
+
+ + 提示数据库满 + +
+
+
+
+ + 提示数据库满 + +
+
+ + + + +
+
+
+ + Y + +
+
+
+
+ + Y + +
+
+ + + + + + +
+
+
+ 输入学生编号 +
+
+
+
+ + 输入学生编号 + +
+
+ + + + + + + + +
+
+
+ 学生编号存在? +
+
+
+
+ + 学生编号存在? + +
+
+ + + + + + +
+
+
+ 提示学生已存在 +
+
+
+
+ + 提示学生已存在 + +
+
+ + + + + + +
+
+
+ 输入学生编号和数量 +
+
+
+
+ + 输入学生编号和数量 + +
+
+ + + + + + +
+
+
+ 添加新学生到数据 +
+
+
+
+ + 添加新学生到数据 + +
+
+ + + + + + +
+
+
+ 提示添加成功 +
+
+
+
+ + 提示添加成功 + +
+
+ + + + + +
+
+
+ N +
+
+
+
+ + N + +
+
+ + + + +
+
+
+ Y +
+
+
+
+ + Y + +
+
+ + + + +
+
+
+ N +
+
+
+
+ + N + +
+
+
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file From fd5bf0c18dd814c69290c6c38715ebea9e6e8df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 21:52:52 +0800 Subject: [PATCH 06/12] 1 --- picture1.drawio.svg => picture-main.drawio.svg | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename picture1.drawio.svg => picture-main.drawio.svg (100%) diff --git a/picture1.drawio.svg b/picture-main.drawio.svg similarity index 100% rename from picture1.drawio.svg rename to picture-main.drawio.svg From bcde9bb514ac9c6c314e6967cfd32999dd3df2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Tue, 25 Apr 2023 22:20:34 +0800 Subject: [PATCH 07/12] 1 --- picture-save.drawio.svg | 139 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 picture-save.drawio.svg diff --git a/picture-save.drawio.svg b/picture-save.drawio.svg new file mode 100644 index 0000000..407ad1a --- /dev/null +++ b/picture-save.drawio.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + +
+
+
+ + save_data + +
+
+
+
+ + save_data + +
+
+ + + + + + +
+
+
+ + 输入文件名 + +
+
+
+
+ + 输入文件名 + +
+
+ + + + + + + + +
+
+
+ 打开文件 +
+
+
+
+ + 打开文件 + +
+
+ + + + + + +
+
+
+ 将所有库存记录写入文件 +
+
+
+
+ + 将所有库存记录写入文件 + +
+
+ + + + + + +
+
+
+ 关闭文件 +
+
+
+
+ + 关闭文件 + +
+
+ + + + + + +
+
+
+ 提示打开文件失败 +
+
+
+
+ + 提示打开文件失败 + +
+
+ +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file From 61849e562bf3d6d4a9ddb0fd179dccc773ce80ea Mon Sep 17 00:00:00 2001 From: p3i57hfqk <2939336468@qq.com> Date: Wed, 26 Apr 2023 19:05:54 +0800 Subject: [PATCH 08/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48ad77d..dcc7f5d 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ Step 1:输入学生学号 Step 2:判断学号是否存在 Step 3:若存在则将其删除 Step 4:否则提示不存在并结束 - +![delete.draw](/delete.drawio.svg) ### sort_data From ee459453b62e6c985316bc21f13c6bbdb5b85a77 Mon Sep 17 00:00:00 2001 From: p3i57hfqk <2939336468@qq.com> Date: Wed, 26 Apr 2023 19:09:38 +0800 Subject: [PATCH 09/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcc7f5d..9f61cd1 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ Step 1:输入学生学号 Step 2:判断学号是否存在 Step 3:若存在则将其删除 Step 4:否则提示不存在并结束 -![delete.draw](/delete.drawio.svg) +![delete.draw](/delete.drawio.svg) ### sort_data From 7a2400d0ee0e03ac573402a497184997efd95266 Mon Sep 17 00:00:00 2001 From: p3i57hfqk <2939336468@qq.com> Date: Wed, 26 Apr 2023 19:14:21 +0800 Subject: [PATCH 10/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f61cd1..48ad77d 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ Step 1:输入学生学号 Step 2:判断学号是否存在 Step 3:若存在则将其删除 Step 4:否则提示不存在并结束 -![delete.draw](/delete.drawio.svg) + ### sort_data From de6f55d43781eb3acc38276eeaa94fde4f22f06e Mon Sep 17 00:00:00 2001 From: pfehg54j3 <3123893053@qq.com> Date: Thu, 27 Apr 2023 17:34:26 +0800 Subject: [PATCH 11/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48ad77d..f89a337 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ | ------ | ------ | ------ | ------ | | 25 | 25 | 25 | 25 | ->>>>>>> ec05cf9b65bc3b08589f06d0cbdf8236edde96dd + >>>>>>> >>>>>> >>>>> From 3e23e2b969da9b501d253419cc6376b429658e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=9B=BD=E5=B9=B3?= <@bzu.edu.cn> Date: Thu, 27 Apr 2023 17:37:07 +0800 Subject: [PATCH 12/12] 1 --- daima | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/daima b/daima index e69de29..8f337db 100644 --- a/daima +++ b/daima @@ -0,0 +1,90 @@ +} + else + { + printf("学生已存在"); + } +} + +//修改 +void update_data(void) +{ + int num; + printf("输入学生学号:"); + scanf("%d", &num); + int f = 0; + for (int i = 0; i < num_parts; i++) + { + if (num == stu[i].number) + { + f = 1; + break; + } + } + if (f == 0) + { + printf("学生不存在"); + } + else + { + printf("输入学生学号:"); + scanf("%d", &stu[num].number); + printf("输入学生姓名:"); + scanf("%s", stu[num].name); + printf("输入学生成绩:"); + scanf("%d", &stu[num].score); + printf("学生 %d 已更新", num); + } +} + +//删除 +void delete_data(void) +{ + int num; + printf("输入学生学号:"); + scanf("%d", &num); + int f = 0, i, j; + for (i = 0; i < num_parts; i++) + { + if (num == stu[i].number) + { + f = 1; + break; + } + } + if (f == 0) + { + printf("学生不存在"); + } + else + { + for (j = i; j < num_parts - 1; j++) + { + stu[j] = stu[j + 1]; + } + num_parts--; + printf("删除成功"); + } +} + +void read_data(void) +{ + puts("读取数据"); + printf("请输入文件名"); + char filename[256]; + scanf("%s", filename); + + FILE *fp = fopen(filename, "r"); + if (fp == NULL) + { + perror(filename); + return; + } + int i = 0; + while (fscanf(fp, "%d,%[^,],%d", &stu[i].number, stu[i].name, &stu[i].score) == 3) + { + i++; + } + fclose(fp); + num_parts = i; + printf("读取 %d 记录\n", num_parts); +}