# 学生管理系统
## 一、设计目标
通过本次较为完整的项目开发,更加理解其项目开发的流程。
通过本次代码设计,理解其模块化程序设计的理念。利用其子程序实现“概念层”与“实现层”的分离。
理解应用设计时将其设计流程抽象为单独的子程序,分为“概念层”。实际的功能细节时分为“实现层”。
## 二、总体设计
### 2.1 设计框图
![](https://www.writebug.com/myres/static/uploads/2022/3/9/6506cd4134c48db370a492c8968d05bc.writebug)
### 2.2 设计流程图
![](https://www.writebug.com/myres/static/uploads/2022/3/9/1a15b46fe4657c4e97b7c3ba3a3fd6ce.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/f05adba826f4f124f1b10db6e9d429e6.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/e8f5112a2596ae1332eb26276650a680.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/dac5d0896fcd7bc15c8fec40a95a3521.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/a7b439904e4511eb030ff46b62f6d6af.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/3ab0148ebaa406f858b327259b1432a2.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/82d122bff908a5e98456b3566d2aff0b.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/a7402273db91020a3fecb453c012ecc2.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/3/9/36254bcbf8ba3e5b296210962b3172a4.writebug)
## 三、详细设计
### 3.1 主函数
```c++
int main(int argc, char *argv[]) {
InitializationStudentSystem();
Handle_argv(argc, argv);
int selectFun;
while (true) {
ret:
selectFun = getchar(); //选择的功能序号
ClearInputBuffer(selectFun);
switch (selectFun) {
case '1': /*录入学生信息*/
InputStudentInfo(g_studentDB);
break;
case '2': /*排序学生信息*/
ShowSortStudentInfoTable(g_studentDB);
break;
case '3': /*搜索学生信息*/
ShowSearchStudent(g_studentDB);
break;
case '4': /*删除学生信息*/
DeleteStudent(g_studentDB);
break;
case '5': /*显示学生信息*/
ShowStudentInfoTable(g_studentDB);
break;
case '6': /*导入csv学生信息*/
ImportStudent(g_studentDB, NULL);
break;
case '7': /*导出csv学生信息*/
ExportStudent(g_studentDB, NULL);
break;
case '8': /*编辑学生信息*/
EditStudent(g_studentDB);
break;
case '0':
exit(EXIT_SUCCESS);
break;
default:
ShowMenu();
goto ret; //序号错误,在返回重新输入
break;
}
ShowMenu();
}
return 0;
}
```
### 3.2 录入
```c++
void InputStudentInfo(sqlite3 *_studentDB) {
ClearCconsoleScreen;
student info;
do {
inputStudent_st(&info);
if (info.no <= 0) { //输入0则退出。
break;
}
int rc;
rc = sqlite3_exec(_studentDB, GetInstertSQL(info), NULL, NULL, NULL);
if (rc != SQLITE_OK) {
printf_s("\n\t学号%"PRId64"的学生已有。", info.no);
}
else {
printf_s("\n\t");
}
} while (IsContinueKeyChar("回车键继续录入,'0'退出:", '\n', false));
}
```
### 3.3 排序
```c++
void ShowSortStudentInfoTable(sqlite3 *_studentDB) {
ClearCconsoleScreen;
do {
printf_s(
" 1、学号\n"
" 2、姓名\n"
" 3、课程编号\n"
" 4、课程名称\n"
" 5、学分\n"
" 6、平时成绩\n"
" 7、实验成绩\n"
" 8、考试成绩\n"
" 9、综合成绩\n"
"10、重修\n"
"输入 (以上序号)[asc|desc] 组合,会以指定的组合方式排序。\n"
"asc升序(从小到大),desc降序(从大到小)。\n"
"例如输入 6desc 则按照平时成绩降序排序。\n\n"
"请输入排序组合,'0'退出:"
);
int selectNumber;
char selectOrder;
scanf_s("%d%c", &selectNumber, &selectOrder, 1);
if ('\n' != selectOrder) {
ClearInputBuffer(getchar());
}
if (0 == selectNumber) {
return;
}
if (selectNumber < 1 || selectNumber > 10) { //确保序号在范围内
selectNumber = 1;
}
char *fieldName[] = {
"no",
"name",
"courseNumber",
"courseName",
"credit",
"peacetime",
"experiment",
"examination",
"comprehensive",
"repair"
};
char sql[SQL_SIZE];
sprintf_s(
sql,
SQL_SIZE,
"SELECT * FROM `"STUDENT_INFOTABLE_NAME"` ORDER BY `%s` %s",
fieldName[selectNumber - 1],
'd' == tolower(selectOrder) ? "DESC" : "ASC"
);
QueryShowStudentInfoPaging(_studentDB, sql);
} while (IsContinueKeyChar("回车键继续排序,'0'退出:", '\n', false));
}
```
## 3.4 搜索
```c++
void ShowSearchStudent(sqlite3 *_studentDB) {
ClearCconsoleScreen;
do {
printf_s(
"支持精确/模糊搜索。\n"
"通配符'%%'或'_',%%匹配多个字符,_匹配单个字符。\n"
"请输入搜索的关键字(学号|姓名|综合成绩):"
);
char searchKey[NAME_SIZE];
scanf_s("%s", searchKey, NAME_SIZE);
ClearInputBuffer(getchar());
char sql[SQL_SIZE];
sprintf_s(
sql, SQL_SIZE,
"SELECT * FROM `"STUDENT_INFOTABLE_NAME"` WHERE `no` LIKE '%s' OR `name` LIKE '%s' OR `comprehensive` LIKE '%s'",
searchKey, searchKey, searchKey
);
QueryShowStudentInfoPaging(_studentDB, sql);
} while (IsContinueKeyChar("回车键继续搜索,'0'退出搜索:", '\n', false));
}
```
### 3.5 删除
```c++
void DeleteStudent(sqlite3 *_studentDB) {
ClearCconsoleScreen;
do {
printf_s(
"支持精确/模糊搜索。\n"
"通配符'%%'或'_',%%匹配多个字符,_匹配单个字符。\n"
"请输入要删除学生的关键字:"
);
char searchKey[NAME_SIZE];
scanf_s("%s", searchKey, NAME_SIZE);
ClearInputBuffer(getchar());
char sql[SQL_SIZE];
sprintf_s(
sql, SQL_SIZE,
"SELECT * FROM `"STUDENT_INFOTABLE_NAME"` WHERE `no` LIKE '%s' OR `name` LIKE '%s' OR `comprehensive` LIKE '%s'",
searchKey, searchKey, searchKey
);
QueryShowStudentInfoPaging(_studentDB, sql);
if (IsContinueKeyChar("确认删除以上学生?'Y'删除,'0'取消:", 'Y', true)) {
sprintf_s(
sql, SQL_SIZE,
"DELETE FROM `"STUDENT_INFOTABLE_NAME"` WHERE `no` LIKE '%s' OR `name` LIKE '%s' OR `comprehensive` LIKE '%s';",
searchKey, searchKey, searchKey
);
sqlite3_exec(_studentDB, ANSIToUTF8_static(sql), NULL, NULL, NULL);
printf_s("删除成功。\n");
}
else {
printf_s("已取消删除操作。\n");
}
} while (IsContinueKeyChar("回车键继续删除,'0'退出:", '\n', false));
}
```
### 3.6 显示
```c++
void ShowStudentInfoTable(sqlite3 *_studentDB) {
ClearCconsoleScreen;
QueryShowStudentInfoPaging(_studentDB, "SELECT * FROM `"STUDENT_INFOTABLE_NAME"`"
没有合适的资源?快使用搜索试试~ 我知道了~
基于C语言实现(控制台)学生管理系统【100010726】
共57个文件
png:20个
h:9个
c:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 45 浏览量
2023-02-09
09:17:33
上传
评论
收藏 9.2MB ZIP 举报
温馨提示
详情介绍:https://www.yuque.com/sxbn/ks/100010726 主要功能:1、录入学生信息;2、排序学生信息;3、搜索学生信息;4、删除学生信息;5、显示学生信息;6、导入学生信息;7、导出学生信息;8、编辑学生信息;9、退出管理系统。
资源推荐
资源详情
资源评论
收起资源包目录
100010726-基于C语言实现(控制台)学生管理系统.zip (57个子文件)
stusy-master
StudentSystem.sln 1KB
.gitattributes 2KB
doc
学生管理系统 Version 7.0 Alpha报告 唐金健.pdf 1.99MB
Student System.xlsx 30KB
学生管理系统 Version 7.0 Alpha报告 唐金健 不含附录源码.pdf 1.47MB
学生管理系统 Version 7.0 Alpha报告 唐金健.docx 1.33MB
Student System 程序框图.docx 20KB
学生管理系统 Version 7.0 Alpha报告 唐金健 不含附录源码.docx 1.3MB
LICENSE 1KB
V3
stdafx.h 535B
stdafx.c 196B
studentDB.c 18KB
sqlite3.c 6.77MB
student1.csv 538B
student.db 16KB
sqlite3.h 486KB
sqlite3ext.h 29KB
miscellaneous.c 4KB
code.c 2KB
main.h 717B
ReadMe.txt 1KB
miscellaneous.h 2KB
sqlite3.dll 828KB
studentDB.h 1KB
V3.vcxproj 9KB
sqlite3aux.c 2KB
student2.csv 1KB
main.c 3KB
D自集成162.csv 2KB
sqlite3aux.h 1004B
targetver.h 268B
D自集成161.csv 2KB
V3.vcxproj.filters 2KB
sqlite3.lib 55KB
code.h 2KB
README.docx-md
9-340fe93c66cd0dc5b79a8a7a25c94634.png 2KB
15-d8ae555d6d7a0ce01ce46141a48943a1.png 148KB
19-189fefca1845860f1ed53bcf1b8c6566.png 167KB
10-d64ade17f23894942c024ca5aab42869.png 4KB
11-18d9f64668da6484290d628490d34335.png 49KB
2-dcb67bef6b2d6f8b5b643bd286defc3b.png 9KB
8-6f08e34ec7117b90a4898ea62792001f.png 2KB
13-06dd3930a545ba69473bb6e4b057d330.png 135KB
14-94e5ba87a66b60f529bee93da6e58b2b.png 147KB
16-77ae4d7f522ac7007db26e8ad3d39e27.png 146KB
17-965e47dfc072968fc81585ded43de180.png 130KB
1-9917bf07f637578d5d081f5dfdd58ef0.png 33KB
20-5ab61aa81b2c844b6bc998e0877c7ae5.png 120KB
5-b6f7d174d626c9c3cf871e8fd124b4e6.png 6KB
6-dcb43661450cfc4bbf94b41560aa9c76.png 6KB
4-e37b768660b8ff461f4a217d4849b97c.png 7KB
12-1f6c9e43859cbfdc75c4185ef1ff4778.png 92KB
7-c7fb4ae0e262c33612b1eff2b87a7a2f.png 4KB
18-ea5da8c13895f63810299576e5301f0d.png 132KB
3-d0b5ec0682dd39a492631d4a058e2bb2.png 22KB
.gitignore 4KB
README.md 60KB
共 57 条
- 1
资源评论
神仙别闹
- 粉丝: 2712
- 资源: 7668
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功