From 5408f0b622b2bfc4c4da6a42884f64f41692270e Mon Sep 17 00:00:00 2001 From: flykhan Date: Fri, 21 Jul 2023 00:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AE=A1=E7=90=86=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=20=E6=B7=BB=E5=8A=A0=E6=96=87=E6=9C=AC=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E8=AF=BB=E5=8F=96;=20=E6=96=87=E4=BB=B6=E8=AF=BB?= =?UTF-8?q?=E5=86=99=E5=A4=8D=E5=88=B6=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day14/homework/h1.c | 43 +++ day14/homework/h2.c | 48 ++++ day14/homework/h3.c | 99 +++++++ day14/homework/h4.c | 63 +++++ day14/homework/h5.c | 35 +++ day14/homework/h6.c | 523 +++++++++++++++++++++++++++++++++++ day14/homework/score.txt | Bin 0 -> 240 bytes day14/homework/stu.date | 2 + day14/homework/stuManSys.out | Bin 0 -> 17704 bytes day14/homework/sxxx.dest | Bin 0 -> 240 bytes day14/homework/xh1.out | Bin 0 -> 8992 bytes day14/homework/xh2.out | Bin 0 -> 9008 bytes day14/homework/xh3.out | Bin 0 -> 9072 bytes day14/homework/xh4.out | Bin 0 -> 8960 bytes day14/homework/xh5.out | Bin 0 -> 8840 bytes 15 files changed, 813 insertions(+) create mode 100644 day14/homework/h1.c create mode 100644 day14/homework/h2.c create mode 100644 day14/homework/h3.c create mode 100644 day14/homework/h4.c create mode 100644 day14/homework/h5.c create mode 100644 day14/homework/h6.c create mode 100644 day14/homework/score.txt create mode 100644 day14/homework/stu.date create mode 100755 day14/homework/stuManSys.out create mode 100644 day14/homework/sxxx.dest create mode 100755 day14/homework/xh1.out create mode 100755 day14/homework/xh2.out create mode 100755 day14/homework/xh3.out create mode 100755 day14/homework/xh4.out create mode 100755 day14/homework/xh5.out diff --git a/day14/homework/h1.c b/day14/homework/h1.c new file mode 100644 index 0000000..1f55947 --- /dev/null +++ b/day14/homework/h1.c @@ -0,0 +1,43 @@ +// 随机生成10位学生的成绩并写入到score.txt文件中 +// 【要求】随机生成学号和成绩,每一行存储一位学生的成绩,学号与成绩之间用 ","逗号分隔。 +// 【提示】成绩范围[0, 100] +#include +#include +#include + +typedef struct stu_s +{ + int sid; + char dh; // 逗号 + float score; + + struct stu_s *next; +} STU; + +int main() +{ + FILE *fp = fopen("score.txt", "w"); + srand(time(NULL)); + // float scorex = rand() % 101; + for (int i = 0; i < 10; i++) + { + if (NULL == fp) + { + perror("fopen"); + return 1; + } + STU *stu = malloc(sizeof(STU)); + + stu->sid = i + 1; + stu->dh = ','; // 间隔的逗号 + stu->score = rand() % 101; + fwrite(stu, sizeof(STU), 1, fp); + // fputc('\n', fp); // 添加换行 + + free(stu); + } + + fclose(fp); + + return 0; +} \ No newline at end of file diff --git a/day14/homework/h2.c b/day14/homework/h2.c new file mode 100644 index 0000000..6fac881 --- /dev/null +++ b/day14/homework/h2.c @@ -0,0 +1,48 @@ +// 按行读取score.txt文件的所有内容,打印成绩及格的学号和成绩。 +#include +#include +#include + +typedef struct stu_s +{ + int sid; + char dh; // 逗号 + float score; + + struct stu_s *next; +} STU; + +int main() +{ + FILE *fp = fopen("score.txt", "r"); + + if (NULL == fp) + { + return 1; + } + + // 计算文件大小 + fseek(fp, 0, SEEK_END); + long file_size = ftell(fp); + printf("score.txt 文件大小: %ld B\n", file_size); + + // 重置光标位置 + fseek(fp, 0, SEEK_SET); // 等同于使用 rewind(fp); + // 按照 STU 的结构存储数据,计算出以存放学生数量 + int stu_num = file_size / sizeof(STU); + printf("学生数量: %d\n", stu_num); + + printf("\n学号\t成绩\n"); + for (int i = 0; i < stu_num; i++) + { + STU *s = calloc(1, sizeof(STU)); + fread(s, sizeof(STU), 1, fp); + if (s->score > 60) + printf("%d\t%.2f\n", s->sid, s->score); + free(s); + } + + fclose(fp); + + return 0; +} \ No newline at end of file diff --git a/day14/homework/h3.c b/day14/homework/h3.c new file mode 100644 index 0000000..5d48e14 --- /dev/null +++ b/day14/homework/h3.c @@ -0,0 +1,99 @@ +// 按行读取score.txt文件的所有内容,并生成有序的链表,且打印链表数据。 +#include +#include +#include + +typedef struct stu_s +{ + int sid; + char dh; // 逗号 + float score; + + struct stu_s *next; +} STU; + +// 打印链表 +void show(STU *head) +{ + if (NULL == head) + { + printf("数据为空,无法打印\n"); + return; + } + STU *tp = head; + printf("\n学号\t成绩\n"); + while (NULL != tp) + { + printf("%d\t%.2f\n", tp->sid, tp->score); + tp = tp->next; + } +} + +// 添加学生 +STU *insert_stu(STU *head, STU *item) +{ + // 如果头指针为空,说明链表为空,直接将新建的节点作为头指针 + if (head == NULL) + { + head = item; + } + else + { + // 如果头指针不为空,说明链表不为空,需要找到链表的尾部,将新建的节点插入到尾部 + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (p->next != NULL) // 当 p 的下一个节点不为空时,说明 p 不是尾部 + { + p = p->next; // p 一直向后移动,直到找到尾部 + } + p->next = item; // 将 item 插入到尾部 + } + return head; // 返回头指针 +} + +int main() +{ + FILE *fp = fopen("score.txt", "r"); + + if (NULL == fp) + { + return 1; + } + + STU *head = NULL; // 建立链表头节点 + + // 计算文件大小 + fseek(fp, 0, SEEK_END); + long file_size = ftell(fp); + printf("score.txt 文件大小: %ld B\n", file_size); + + // 重置光标位置 + fseek(fp, 0, SEEK_SET); // 等同于使用 rewind(fp); + // 按照 STU 的结构存储数据,计算出以存放学生数量 + int stu_num = file_size / sizeof(STU); + printf("学生数量: %d\n", stu_num); + + // printf("\n学号\t成绩\n"); + for (int i = 0; i < stu_num; i++) + { + // 为新的链表节点分配内存空间 + STU *s = calloc(1, sizeof(STU)); + // 从文件中读取一个学生的数据 + fread(s, sizeof(STU), 1, fp); + + head = insert_stu(head, s); // 插入链表节点 + } + show(head); // 显示链表内容 + + // 最后循环释放动态申请的内存 + STU *free_tp = head; + while (free_tp != NULL) + { + STU *to_free_this_p = free_tp; + free_tp = free_tp->next; + free(to_free_this_p); + } + + fclose(fp); + + return 0; +} \ No newline at end of file diff --git a/day14/homework/h4.c b/day14/homework/h4.c new file mode 100644 index 0000000..59bac46 --- /dev/null +++ b/day14/homework/h4.c @@ -0,0 +1,63 @@ +// 从score.txt中查找所有大于90分的学生信息(学号、成绩),并统计学生的数量和平均成绩。 +#include +#include +#include + +typedef struct stu_s +{ + int sid; + char dh; // 逗号 + float score; + + struct stu_s *next; +} STU; + +int main() +{ + FILE *fp = fopen("sxxx.dest", "rb"); + // FILE *fp = fopen("score.txt", "r"); + + if (NULL == fp) + { + return 1; + } + + // 计算文件大小 + fseek(fp, 0, SEEK_END); + long file_size = ftell(fp); + printf("score.txt 文件大小: %ld B\n", file_size); + + // 重置光标位置 + fseek(fp, 0, SEEK_SET); // 等同于使用 rewind(fp); + // 按照 STU 的结构存储数据,计算出以存放学生数量 + int stu_num = file_size / sizeof(STU); + printf("学生数量: %d\n", stu_num); + + int above_90_stu_nums = 0; // 大于 90 分的学生数 + float sum_score_of_above_90_stus = 0.0f; // 大于 90 分学生的总成绩 + + // printf("\n学号\t成绩\n"); + for (int i = 0; i < stu_num; i++) + { + // 为新的链表节点分配内存空间 + STU *s = calloc(1, sizeof(STU)); + // 从文件中读取一个学生的数据 + fread(s, sizeof(STU), 1, fp); + + if (s->score > 90) + { + above_90_stu_nums++; + // printf("%.2f\n", s->score); + sum_score_of_above_90_stus += s->score; + } + + free(s); + } + + float avg_score_of_above_90_stus = sum_score_of_above_90_stus / above_90_stu_nums; + printf("\n大于 90 分的学生有 %d 位,他们的平均成绩为 %.2f\n", above_90_stu_nums, avg_score_of_above_90_stus); + + fclose(fp); + + return 0; +} \ No newline at end of file diff --git a/day14/homework/h5.c b/day14/homework/h5.c new file mode 100644 index 0000000..99ae33b --- /dev/null +++ b/day14/homework/h5.c @@ -0,0 +1,35 @@ +// 设计函数, int filecpy(char *src_file, char *dst_file)的功能,实现文件src_file备份到dst_file, 如果成功返回 0, 失败返回 1 +#include + +int filecpy(char *src_file, char *dst_file) +{ + FILE *aF = fopen(src_file, "rb"); + FILE *bF = fopen(dst_file, "wb"); + + if (NULL == aF) + { + perror("src_file fopen"); + return 1; + } + if (NULL == bF) + { + perror("dst_file fopen"); + return 1; + } + + int temp_c = fgetc(aF); + while (temp_c != EOF) + { + fputc(temp_c, bF); + temp_c = fgetc(aF); + } + fclose(aF); + fclose(bF); + return 0; +} + +int main() +{ + filecpy("score.txt", "sxxx.dest"); + return 0; +} \ No newline at end of file diff --git a/day14/homework/h6.c b/day14/homework/h6.c new file mode 100644 index 0000000..8e96db0 --- /dev/null +++ b/day14/homework/h6.c @@ -0,0 +1,523 @@ +// 优化昨天的学生信息管理系统,将STU的数据持久化到stu.data文件中 +// 【提示】运行程序时,从文件中加载已有数据并生成链表,在退出程序时,将链表的数据更新到文件中。 +#include +#include // malloc +#include // strcpy + +typedef enum front_color_e +{ + BLACK = 30, // 黑色 + RED, // 红色 + GREEN, // 绿色 + YELLOW, // 黄色 + BLUE, // 蓝色 + PURPLE, // 紫色 + CYAN, // 青色 + WHITE, // 白色 +} Front_Color; // 前景色 + +typedef enum back_color_e +{ + BLACK_B = 40, // 黑色 + RED_B, // 红色 + GREEN_B, // 绿色 + YELLOW_B, // 黄色 + BLUE_B, // 蓝色 + PURPLE_B, // 紫色 + CYAN_B, // 青色 + WHITE_B, // 白色 +} Back_Color; // 背景色 + +typedef enum attr_e +{ + BOLD = 1, // 加粗 + UNDERLINE = 4, // 下划线 + BLINK, // 闪烁 + REVERSE = 7, // 反显 + HIDE, // 隐藏 +} Attr; // 文本属性 + +// 定义学生信息结构体,链表的节点 +typedef struct stu_s +{ + int sid; + char name[32]; + int age; + + struct stu_s *next; +} STU; + +// 节点交换 +void swap(STU *a, STU *b) +{ + // 方法一: 直接通过临时指针交换数据 + // STU *tp = (STU *)malloc(sizeof(STU)); + // tp->sid = a->sid; + // strcpy(tp->name, a->name); + // tp->age = a->age; + + // a->sid = b->sid; + // strcpy(a->name, b->name); + // a->age = b->age; + + // b->sid = tp->sid; + // strcpy(b->name, tp->name); + // b->age = tp->age; + // free(tp); // 释放临时指针 + + // 方法二: 通过结构体指针交换数据 + // 先换数据 + STU *tp = malloc(sizeof(STU)); + *tp = *a; + *a = *b; + *b = *tp; + + // 再换指针的下一个节点指向 + tp->next = a->next; + a->next = b->next; + b->next = tp->next; + + free(tp); // 释放临时指针 +} + +// 添加学生 +STU *insert_stu(STU *head, STU *item) +{ + // 如果头指针为空,说明链表为空,直接将新建的节点作为头指针 + if (head == NULL) + { + head = item; + } + else + { + // 如果头指针不为空,说明链表不为空,需要找到链表的尾部,将新建的节点插入到尾部 + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (p->next != NULL) // 当 p 的下一个节点不为空时,说明 p 不是尾部 + { + p = p->next; // p 一直向后移动,直到找到尾部 + } + p->next = item; // 将 item 插入到尾部 + } + return head; // 返回头指针 +} + +// 删除学生 +STU *delete_stu(STU *head, char sid) +{ + if (NULL == head) + { + printf("\033[%dm无数据,无法删除\033[0m\n", RED); + return NULL; + } + if (head->sid == sid) + { + // *tp 为临时指针,用来保存头指针 + STU *tp = head; // 保存头指针 + head = head->next; // 头指针指向下一个节点 + free(tp); // 释放头指针 + } + else + { + STU *tp = head; // 保存头指针 + while (NULL != tp->next && sid != tp->next->sid) // 当 tp 的下一个节点不为空时,且下一个节点的学号不等于要删除的学号时,继续向后移动指针 tp + { + tp = tp->next; // tp 一直向后移动,直到找到尾部 + } + if (NULL == tp->next) // 到达了链表尾部还是没有找到要删除的内容 + { + printf("\033[%dm未找到 sid = %d 的学生,删除失败\033[0m\n", RED, sid); + } + else + { + STU *tpx = tp->next; // 保存要删除的节点 + tp->next = tpx->next; // 将链表位置指向要删除的节点的下一个节点 + free(tpx); // 释放要删除的节点 + printf("\033[%dm删除 sid = %d 的学生成功\033[0m\n", BLUE, sid); + } + } + return head; // 返回头指针 +} + +// 打印学生 +void shows(STU *head) +{ + // 如果头指针为空,说明链表为空,直接返回 + if (head == NULL) + { + printf("\033[%dm无数据,无法打印\033[0m\n", RED); + return; + } + else + { + // 如果头指针不为空,说明链表不为空,需要遍历链表,打印每一个节点的信息 + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + // 清屏 + // printf("\033[2J"); + printf("--------------------\n"); + printf("\033[%dm学号\t姓名\t年龄\033[0m\n", BLUE_B); + while (p != NULL) // 当 p 不为空时,说明 p 不是尾部,则打印 p 的信息 + { + printf("\033[%dm%d\t%s\t%d\033[0m\n", BLUE, p->sid, p->name, p->age); // 打印 p 的信息 + p = p->next; // p 一直向后移动,直到找到尾部 + } + } +} + +// 查询学生 +STU *find_stu(STU *head, char sid) +{ + if (NULL == head) + { + printf("\033[%dm无数据,无法查询\033[0m\n", RED); + return NULL; // 返回空指针,说明没有找到要查询的节点 + } + + STU *tp = head; // 保存头指针 + while (NULL != tp->next && sid != tp->sid) // 当 tp 的下一个节点不为空时,且下一个节点的学号不等于要查询的学号时,继续向后移动指针 tp + { + tp = tp->next; // tp 一直向后移动,直到找到尾部 + } + if (sid == tp->sid) + return tp; // 返回当前节点的指针,即为要查询的节点 + return NULL; // 返回空指针,说明没有找到要查询的节点 +} + +// 修改学生 +STU *update_stu(STU *head, char sid) +{ + if (NULL == head) + { + printf("\033[%dm无数据,无法修改\033[0m\n", RED); + return NULL; + } + + STU *tp = find_stu(head, sid); // 查找要修改的节点 + if (tp == NULL) + { + printf("\033[%dm未找到 sid = %d 的学生\033[0m\n", RED, sid); + } + else + { + // 临时变量,用来保存要修改的学生信息 + char msid; + char mname[32]; + int mage; + + // 输入要修改的内容 + printf("输入要修改的学生的 学号 姓名 年龄: "); + scanf("%hhd %s %d", &msid, mname, &mage); + tp->sid = msid; + strcpy(tp->name, mname); + tp->age = mage; + // 修改成功 + printf("\033[%dm修改 sid = %d 的学生成功\033[0m\n", BLUE, sid); + } + return head; // 返回头指针 +} + +// 排序学生(选择排序,也可以使用归并排序) +STU *sort_stu(STU *head) +{ + if (NULL == head) + { + printf("\033[%dm无数据,无法排序\033[0m\n", RED); + return NULL; + } + // 选择排序方式: 1) 按照sid 2)按照age + int choose; // 选择排序方式 + printf("选择排序方式: 1) 按照sid 2)按照age: "); + scanf("%d", &choose); + if (1 == choose) // 按照sid排序 + { + // 选择排序方式: 1) 升序 2)降序 + int choose2; // 选择排序方式 + printf("选择排序方式: 1) 升序 2)降序: "); + scanf("%d", &choose2); + if (1 == choose2) // 升序 + { + // 按照sid升序排序 + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (p != NULL) // 相当于 for (int i = 0; i < len; i++) + { + STU *q = p->next; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (q != NULL) // 相当于 for (int j = i + 1; j < len; j++) + { + if (p->sid > q->sid) // 相当于 if (arr[i] > arr[j]) + { + swap(p, q); // 相当于 swap(arr[i], arr[j] + } + q = q->next; + } + p = p->next; + } + } + else if (2 == choose2) // 降序 + { + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (p != NULL) + { + STU *q = p->next; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (q != NULL) + { + if (p->sid < q->sid) + { + swap(p, q); + } + q = q->next; + } + p = p->next; + } + } + else + { + // 选择错误 + printf("\033[%dm选择错误\033[0m\n", RED); + } + } + else if (2 == choose) // 按照age排序 + { + // 选择排序方式: 1) 升序 2)降序 + int choose2; // 选择排序方式 + printf("选择排序方式: 1) 升序 2)降序: "); + scanf("%d", &choose2); + if (1 == choose2) // 升序 + { + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (NULL != p) + { + STU *q = p->next; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (NULL != q) + { + if (p->age > q->age) + { + swap(p, q); + } + q = q->next; + } + p = p->next; + } + } + else if (2 == choose2) // 降序 + { + STU *p = head; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (NULL != p) + { + STU *q = p->next; // 创建一个临时指针,用来保存头指针,防止头指针丢失 + while (NULL != q) + { + if (p->age < q->age) + { + swap(p, q); + } + q = q->next; + } + p = p->next; + } + } + else + { + // 选择错误 + printf("\033[%dm选择错误\033[0m\n", RED); + } + } + else + { + // 选择错误 + printf("\033[%dm选择错误\033[0m\n", RED); + } + return head; // 返回头指针 +} + +// 反序学生(头变尾,尾变头) +STU *reverse_stu(STU *head) +{ + if (NULL == head) + { + printf("\033[%dm无数据,无法反序\033[0m\n", RED); + return NULL; + } + + STU *pi = head->next; // 当前节点的下一个节点地址 + head->next = NULL; // 把头节点的下一个节点置空,让头节点成为尾节点 + STU *tp = NULL; // 当前节点的下一个节点地址 pi 的下一个节点地址 + while (pi != NULL) // 当 pi 不为空时,说明 pi 不是尾部,则反序 pi 的信息 + { + tp = pi->next; // 首先 tp 保存 pi 的下一个节点地址 + pi->next = head; // 然后把 pi 的下一个节点地址指向 head + head = pi; // 然后让 hand 指向 pi + pi = tp; // 最后找到新的 pi,即 tp + } + + printf("\033[%dm反序成功\033[0m\n", BLUE); + return head; // 返回头指针 +} + +// 保存数据到文件 +void saveToFile(STU *head, const char *filename) +{ + FILE *file = fopen(filename, "w"); + if (file == NULL) + { + printf("\033[%dm无法打开文件, 保存数据失败\033[0m", RED); + return; + } + + STU *current = head; // 定义临时指针,用来保存头指针,防止头指针丢失 + while (current != NULL) // 当 p 不为空时,说明 p 不是尾部,则打印 p 的信息 + { + // 格式化存储数据,每个字段之间用逗号分隔 + fprintf(file, "%d,%s,%d\n", current->sid, current->name, current->age); + current = current->next; // p 一直向后移动,直到找到尾部 + } + printf("保存数据成功\n"); + fclose(file); +} + +// 从文件中读取数据 +STU *readFromFile(const char *filename) +{ + FILE *file = fopen(filename, "r"); + if (file == NULL) + { + printf("\033[%dm无法打开文件, 加载数据失败\033[0m", RED); + return NULL; + } + + STU *head = NULL; // 定义头指针 + STU *prev = NULL; // 定义尾指针 + char line[100]; // 100 个字符的数组,用来保存每一行的数据 + + while (fgets(line, sizeof(line), file) != NULL) // 逐行读取文件内容 + { + STU *node = (STU *)malloc(sizeof(STU)); // 申请一个节点的内存, 用来保存学生信息 + /* + %d :表示读取一个整数,并将其存储在 &(node->sid)的地址中,即学生的学号。 + , :表示读取一个逗号,用于分隔学号和姓名之间的字段。 + %[^,] :表示读取一个字符串,直到遇到逗号为止,并将其存储在 node -> name 中,即学生的姓名。[^,] 表示匹配除逗号以外的任意字符。 + , :表示读取一个逗号,用于分隔姓名和年龄之间的字段。 + %d :表示读取一个整数,并将其存储在 &(node->age)的地址中,即学生的年龄。 + */ + sscanf(line, "%d,%[^,],%d", &(node->sid), node->name, &(node->age)); // 将每一行的数据保存到节点中 + // fscanf() 每次执行后会丢失数据,所以需要使用 sscanf() 函数,原因是 fscanf() 函数会在每次执行后将文件指针向后移动,而 sscanf() 函数不会移动文件指针。 + // fscanf(file, "%d,%[^,],%d\n", &(node->sid), node->name, &(node->age)); // 将每一行的数据保存到节点中 + node->next = NULL; // 新建的节点的下一个节点指向空,因为是尾部插入 + + if (head == NULL) // 当头指针为空时,说明链表为空,直接将新建的节点作为头指针 + { + head = node; + } + else // 否则,说明链表不为空,需要找到链表的尾部,将新建的节点插入到尾部 + { + prev->next = node; // 将新建的节点插入到尾部 + } + prev = node; // 将尾指针指向新建的节点 + } + + fclose(file); + printf("加载数据成功\n"); + return head; +} + +int main(int argc, char const *argv[]) +{ + STU *head = NULL; // 定义全局的头指针 + + // 声明临时变量,用来保存学生信息 + char tsid; + char tname[32]; + int tage; + + // // 创建几个学生信息,用于测试 + // STU *stu1 = (STU *)malloc(sizeof(STU)); + // stu1->sid = 1; + // strcpy(stu1->name, "张三"); + // stu1->age = 18; + // STU *stu2 = (STU *)malloc(sizeof(STU)); + // stu2->sid = 2; + // strcpy(stu2->name, "李四"); + // stu2->age = 21; + // STU *stu3 = (STU *)malloc(sizeof(STU)); + // stu3->sid = 3; + // strcpy(stu3->name, "王五"); + // stu3->age = 15; + // STU *stu4 = (STU *)malloc(sizeof(STU)); + // stu4->sid = 4; + // strcpy(stu4->name, "赵六"); + // stu4->age = 13; + // head = insert_stu(head, stu1); + // head = insert_stu(head, stu2); + // head = insert_stu(head, stu3); + // head = insert_stu(head, stu4); + + while (1) + { + // printf("\033[2J"); + // printf("--------------------\n"); + printf("\t\t \033[%d;%dm学生管理系统\033[0m\n\n", BOLD, CYAN_B); + printf("\033[%d;%dm1) 添加学生 \t2) 删除学生 \t3) 打印 \n4) 查询 \t5) 修改 \t6) 排序 \n7) 反序 \t8) 加载数据 \t0) 退出(保存数据)\n请输入选项# \033[0m", BOLD, GREEN); + int cmd = 0; + scanf("%d", &cmd); + switch (cmd) + { + case 0: + // store_data(head); // 存储数据 + saveToFile(head, "stu.date"); + return 1; + case 1: + printf("输入学生的 学号 姓名 年龄: "); + // 键盘收集数据并动态插入链表 + scanf("%hhd %s %d", &tsid, tname, &tage); // 键盘收集数据 + STU *item = (STU *)malloc(sizeof(STU)); // 申请一个节点的内存, 用来保存学生信息 + item->sid = tsid; // 保存学生学号到新建的节点 + strcpy(item->name, tname); // 保存学生姓名到新建的节点 + item->age = tage; // 保存学生年龄到新建的节点 + item->next = NULL; // 新建的节点的下一个节点指向空,因为是尾部插入 + head = insert_stu(head, item); // 将新建的节点插入到链表中 + break; + case 2: + printf("输入要删除的学生的学号: "); + scanf("%hhd", &tsid); + head = delete_stu(head, tsid); + break; + case 3: + shows(head); + break; + case 4: + printf("输入要查询的学生的学号: "); + scanf("%hhd", &tsid); + head = find_stu(head, tsid); + if (head == NULL) + { + printf("\033[%dm未找到 sid = %d 的学生\033[0m\n", RED, tsid); + } + else + { + printf("查询到的学生信息如下: \n"); + printf("\033[%dm学号\t姓名\t年龄\033[0m\n", BLUE_B); + printf("\033[%dm%d\t%s\t%d\033[0m\n", BLUE, head->sid, head->name, head->age); + } + break; + case 5: + printf("输入要修改的学生的学号:"); + scanf("%hhd", &tsid); + head = update_stu(head, tsid); + break; + case 6: + printf("排序学生信息:\n"); + head = sort_stu(head); + break; + case 7: + printf("反序学生信息:\n"); + head = reverse_stu(head); + break; + case 8: + printf("加载数据......\n"); + head = readFromFile("stu.date"); + break; + default: + printf("\033[%dm选择错误\033[0m\n", RED); + break; + } + } + return 0; +} diff --git a/day14/homework/score.txt b/day14/homework/score.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d7bded96f45b0c60779053e90e8dca86408e107 GIT binary patch literal 240 zcmZQ%U|`SzVg`m9Colyin1D1yT)+`ooEa{@0Y#hzF1`oF99Fpa6clkbxcCtiadx=4 Z35qxeTznOZI44|u7m7F+TwDRgodAzf35fsz literal 0 HcmV?d00001 diff --git a/day14/homework/stu.date b/day14/homework/stu.date new file mode 100644 index 0000000..23fa0e0 --- /dev/null +++ b/day14/homework/stu.date @@ -0,0 +1,2 @@ +4,赵六,13 +1,张三,14 diff --git a/day14/homework/stuManSys.out b/day14/homework/stuManSys.out new file mode 100755 index 0000000000000000000000000000000000000000..37190eb0ea009bd070800764ae574cde08aea7f7 GIT binary patch literal 17704 zcmeHPdvH`$nm_3TNO&Xx5hJ*A*CD%sf+iq@hq`t`8g5w7h>5bJ*mTkz63uJ+A>gb| zoDfLcMp7e=an~v14!&ka!I9Fan8bmVsI|4RMo0EJ%oYjVwqks4<{`bm?>uhbzUg+I z+TB04Dks(bo$vjf@4W84eNVpU+_KS@k-=24vA$+5};(&A}@QUM9%!Ac~5RAo)uahpY-%b-6$l zWK81((xX`O?HmQ%$tw!B$v8SCRCD>T5iu0S6d?~n1`b(FWG1)!^CCZjJHq?}? zTHfec*4WS-+_P-Y+LC1@tL*+3`%2z!vQM&`uB+yrR30^86!TnsXbcd4xbHVp&-?f8 z{pl|+f9rPp>B6Sdo?A&*eNg?z<-3ralR|n%8v2?v^c&OAuTDd+NkeZ)L*JT)?oLB* z16{+%TD}cJs`eJ7p_6PX`Jyy*hJLQ4ZY^Q{fUmZ7FRN>5^)@q?tHIw=yKbG!@2_SEG>=B6v=Qre#{*QrE8DGAWLz-*Tc};v36z}AfY51mbtBPi#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1E5g&r^F zxUS#0@kVErtE#kYi<3O?gITryAdj6N%W^o>K`c6S<*KOK>PqCPYU>8dQkA==(JK#) zCCk&{uw;tIOL@a7uOM@I@kW7L9uiBIvYsbPa4FfA<6{XXg~(5yC6jz!w`ZfTrD*wHr@d*h|QhC-k5iUevW}0wj0rZg(s5dGGZ4{Gxpg&3>b0gis3~ZFXHzl9Iovr2K}zDJ!;*1$6tweKm~3RKMc>i#Go4K7lG5?b}kLC0$*Ey{n7 z&A}ymEb&j_)WmZDiL&cZp?i9z-)D0GW4Q0)K%4+Xm7WVwo~-xdH-Uzw-_Te0Wtt51 z2zcf~Hq7NVAau{J{Hy!7VW}^Vog2?7l$?ThK%brgC|up=jY)lnbY_iTk{Ml>lc>^H z_k+bUVFgmqnmi-5<<*hi~m*wH3^woWQft{=+#+$$<;=cid z@~`yO{l4}M^+%ygLrv+c=K|{gI;j8OpvJd~UyXwvi+^OZYQMVf?w0yidGcj0nII5NiW@AY zzuKUPiqcnbHpt4iS+x3Ufz4Ecl4(J?Z_5znl0z~ehim|?!_+0JJ!<`<`I*XpwtRZH J)xxy;|1Xht>SzD} literal 0 HcmV?d00001 diff --git a/day14/homework/sxxx.dest b/day14/homework/sxxx.dest new file mode 100644 index 0000000000000000000000000000000000000000..8314085a9c32334a6dd19f3565cc174dcc53b370 GIT binary patch literal 240 zcmZQ%U|`SzVg`l^Colyin1D1ydTv5D$qwMg=E36w$6)*i{QV;@3oC#HoGQHvIPrf4xo_B$Q=jtd(CE zIqD*Hf20SoydWGcl*kB!Z16@dF-Dy1_JAGc`LN^>iajD;zJ8e#?ISKkwj~lCY--#R z3D!o!(d1a|SaVZtQ=^oKNe#T+=pS`=?CRr@s2{x`Va}`Jk8=R)%f5S}?+;&GKGyK} zu3!A-`JR^7XSS!&mi|zDXxa&yD|2W+l?QLmgD=a2?*`lpe>*(^K(4qodGLxn_+xqS z`aJmZJUD~#8N%UcVu^Sl8f3$1i%MgEDqe`aG8#P{yuFzscnqlyQko zpX2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d{Hd{8o`))FcKRKMAV=jizn1Ta*Ped zMn)r=t_7v1w{C09t)vczqhU1=j|YybT2zl8h4a9`h^7XUBO^z_#3ZSpsasS-^*p=w z9$#0R+P13|(lc_Uvc)3E)Yfn9@^y8zfR?F-pG5)$N5yKJq8i?m)*hzr=-lo1b*j7D z+xNEhs=YpcXB$S~CzwNtB+s3nU&^xi#8U0(?NS%}skf^Id#N`t7=eRMEf~-P;%wAr zWkK9mBA9Vo@`U-N9^6@5{PyxRDeEx7)V@ejoNW6o1kw zbInNsQ2vD+W$}kJ?`D0t`_GbaZKEeEuXuokvG?@1BMy-)6m6505Z?>m>$$4SV z&pu5C9#JO#y3Kx|Nah*?A|c9Gm}T=P`G-(2$EWv(QDHww9V-kdF4@0jv#0&g`yw#y z^GRQHD~aqU!k)s=`_fHezc#CB6zulDwAs^lVER7X_#f=?^8&V?;?q8?P9*-B&EDRh z??F9&`WClKcE3j7i|zV$8Q;^(P4={}t3;|X52T(wa+E4GJW5Up`kGY!31ps1oW)R9`kKcdIME1lhpps&n_4bH`V>u~`N}Fhz nyJq|Ils`V4fS!Q=7Wh+pXkEr>o-6*8IMDk6-58*UWRL%EFYE|^ literal 0 HcmV?d00001 diff --git a/day14/homework/xh2.out b/day14/homework/xh2.out new file mode 100755 index 0000000000000000000000000000000000000000..0fca07007a71a9bca2a5b3d103309faba2a81646 GIT binary patch literal 9008 zcmeHMeQaCR6~DIg-Qu|AE2L<(pq)acJd!L8p^WnE#OX_wex(kBjr7H_pKF6-8~eGW z3`Vx_QPV-Yjcxg78q>b`nv`kM78R*!SJZ;`PtnGPv}p^dDGr4#sH{W+>Ya1nJP=0tq7tMleW zq%{#w=EhscySrMuI;Ct%>frrG|ERld=MZm+^5_K#W4;RhI0vxax9y{^zp?3)TmBN9 z>-$*0|N8WMKRJiC^oQbSrd^=9wv6_*74Tas;B6IfoR8)F-(CT~u>!uP0v-h13x7Lp z0-#*Gt193O#wU!!(Z!;vw3cL1T}vcbI;Uq@IulRoQ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+Z)i_Bt literal 0 HcmV?d00001 diff --git a/day14/homework/xh3.out b/day14/homework/xh3.out new file mode 100755 index 0000000000000000000000000000000000000000..04311e92613b6f3f1f302929f6d8c05d2f585352 GIT binary patch literal 9072 zcmeHNeQaCR6~DIg-Qc*Tg^;4vf@Uk#;wB*tDGd6Y#OX^(+L9)WZB1XC_$4toc4R-d zDWW4&DBz`qh_B_3O=E&>0>%`?#G*1at%4dVp(#ZJbsw5C)TB0nk*chVw$bdI`|h#* zUTg{NkNw4|-aGgF?)kc(e)p!2dRm&S77HV?vU?axgLx8%^fzM@8@VX3I#$Rewu#-$ z@&L(&N8&Ze^%C)A;hK1X(6a&0fv3)@19eu37l_}i!w^9y$`ComOOYgsI?pNAMdFM( zIe>PUtHaJk;9a~xykF!oC^*@nh<00q-43*NYqv@up)4U|jr^VB zsEf33Uh`r3co7$YOT0ilo85h2hk1TkatOsX5ieW6EQ$6J7b4ph@ORhNYzz1*0{&oh zsA8zDwxYJi6$!bjdArd+>h9Xp!6Q*WIzhtrt%nEa0M`V@k`TQ&|H^6`^GHz9a-?oEI7``O#biAg5R12Uz-JQ2iysdnYIFuDejsq zID_%&!QrT7y`e!h$a*z35MYB*Ey4!F{-D;&dc1)^sE74NRP`a&+Y<;yRMs0-y*{QW zXstvvZ&*_Xyne6_t17^K1EHXR6}GFTxxPWEc2&E!W42b)KOM2aDB?KMe2bR(3$dmL zO@Nk5x;V$V3l&K!b#(D^KD^PM$eD&Gmnu|lNyBko5mlz)w8pTmE)7rLPoy+FeLcx( zIOasOFAb-)k97~E;bJLsldd!z$BsxI`J_M|%~gw>Og?s6%Z*P%jXd&B0rE6j+1>^! zE9LF*F4-hO3FUs&NX)GOmG4FwyDTxw<$9E{s}iTVd?(7-MTrS6SEGzwlX#KKTT#X? zNsMv%7L>6o62n|BLm9guG05e0C}YzTU0g0g8HX~lkIT;#I$7@+$egM^ZH}EkD91jM zM=mbyYj2)8&59%@&zu=6L^iXzKw|O3VEB1&$tKwBCLe_k>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