{"id":20713970,"url":"https://github.com/huanhuanonly/studentdormitorymanagementsystem","last_synced_at":"2025-03-11T06:45:28.937Z","repository":{"id":262256351,"uuid":"886670394","full_name":"huanhuanonly/StudentDormitoryManagementSystem","owner":"huanhuanonly","description":"The student dormitory management system for Yu Feixia's schoolwork. 学生宿舍管理系统。","archived":false,"fork":false,"pushed_at":"2024-11-11T13:57:56.000Z","size":520,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T21:31:24.906Z","etag":null,"topics":["c","flow-charts","oop","trie"],"latest_commit_sha":null,"homepage":"https://github.com/huanhuanonly","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huanhuanonly.png","metadata":{"files":{"readme":"README.md","changelog":"change.png","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-11T11:52:40.000Z","updated_at":"2024-12-24T07:07:50.000Z","dependencies_parsed_at":"2024-11-16T07:45:45.929Z","dependency_job_id":null,"html_url":"https://github.com/huanhuanonly/StudentDormitoryManagementSystem","commit_stats":null,"previous_names":["huanhuanonly/studentdormitorymanagementsystem"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huanhuanonly%2FStudentDormitoryManagementSystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huanhuanonly%2FStudentDormitoryManagementSystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huanhuanonly%2FStudentDormitoryManagementSystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huanhuanonly%2FStudentDormitoryManagementSystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huanhuanonly","download_url":"https://codeload.github.com/huanhuanonly/StudentDormitoryManagementSystem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242988159,"owners_count":20217535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","flow-charts","oop","trie"],"created_at":"2024-11-17T02:28:31.096Z","updated_at":"2025-03-11T06:45:28.886Z","avatar_url":"https://github.com/huanhuanonly.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The StudentDormitoryManagementSystem\n\n_December 28, 2023 by [`Yang Huanhuan`](https://github.com/huanhuanonly) for `Yu Feixia`._\n\n[![ViewCode](https://img.shields.io/badge/View-CODE-green?style=plastic\u0026logo=AdGuard)](main.c)\n---\n\n## 程序流程图如下：\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/flow-chart.png)\n\n## 主页面截图，共设计了八条不同功能的指令：\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/home.png)\n\n以下演示了它的各个指令的使用方法以及对应的运行截图：\n\n1)\t使用 `insert` 插入指令插入两条学生宿舍信息，并使用 `display` 指令打印当前数据库；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/insert.png)\n\n2)\t使用 `remove` 指令删除一条学号为 $230102010202$ 的信息，并使用 `display` 指令打印当前数据库；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/remove.png)\n\n3)\t使用 `change` 指令更改学号为 $230102010201$ 的学生的寝室号为 $301$，名称为 `YuFeixia2`，并使用 `display` 指令打印当前数据库；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/change.png)\n\n4)\t使用 `insert` 指令新增三条指令，并使用 `find` 指令查找出现 $304$ 的数据项；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/find.png)\n\n5)\t使用 `sort` 指令对学号进行排序，并使用 `display` 打印当前数据库，将 `-s` 替换成 `-r` 则是对房间号排序，`-n` 是对名称进行排序；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/sort.png)\n\n6)\t使用 `save` 指令将数据库保存成文件并打开文件进行查看；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/save.png)\n\n7)\t使用 `exit` 指令退出系统；\n\n![](https://raw.githubusercontent.com/huanhuanonly/StudentDormitoryManagementSystem/refs/heads/main/exit.png)\n\n## 设计思想\n继命令行语法，使用 `指令 + 参数` 的形式与学生宿舍信息数据库进行交互，为了代码模板化，这里使用面向对象 _**OOP**_ 编程思想实现这个 C 语言程序结构，使用宏定义的技巧，引入 C++ 中的 `class` 编程，支持类构造、析构、类中方法，并编写了一个简单版的 C++ STL 库中的 `std::vector` 容器，内部使用 `void*` 类型的指针使它支持任何类型，并简单封装 C 语言中的内存管理函数后，给予 `vector` 内部调用，它内部使用动态扩容。在这个程序中，它将作为字符串类型 `std::string`，数据库也将使用它进行存储。\n\n对于指令字符串的解析，这里使用字典树（`Trie`）进行存储对应指令的函数指针，`Trie` 的插入和查找的时间复杂度都是 $O(\\left|S\\right|)$，这个程序中定义了 `trie` 类和它的类函数来维护它的数据。\n\n对于系统中的每个功能都封装成了一个函数，主体代码在 `main` 函数后，它们的函数指针在 `main` 开始时交由 `Trie` 树管理。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuanhuanonly%2Fstudentdormitorymanagementsystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuanhuanonly%2Fstudentdormitorymanagementsystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuanhuanonly%2Fstudentdormitorymanagementsystem/lists"}