Compare commits

...

35 Commits

Author SHA1 Message Date
李培毅 9f89d2c09a Merge branch '计算每个学生各门课程的总分和平均分' of https://bdgit.educoder.net/p2i3t8vuh/text4
2 years ago
p2i3t8vuh c7efbf0796 Update README.md
2 years ago
p2i3t8vuh 431175143d Update README.md
2 years ago
p2i3t8vuh 25957d192f Update README.md
2 years ago
p2i3t8vuh 9c322d2f31 Merge pull request '流程图(2)' (#8) from ps2zk5fnt/text4:流程图(2) into master
2 years ago
Liwenfei 0c1a2a5f32 流程图(2)
2 years ago
p2i3t8vuh a89babd38f Merge pull request '流程图' (#7) from ps2zk5fnt/text4:流程图 into master
2 years ago
Liwenfei f62630ca6a 流程图
2 years ago
p2i3t8vuh abb2b86b41 Update README.md
2 years ago
王振宇 a5bc558918 1
2 years ago
李培毅 f454a56312 1
2 years ago
李培毅 66ec362e0e 1
2 years ago
李培毅 c3b6ec046a 1
2 years ago
李培毅 f107ab7a02 1
2 years ago
李培毅 fde034535c 1
2 years ago
李培毅 9be93bf151 1
2 years ago
李培毅 640432dabf 1
2 years ago
李培毅 8339cbf410 1
2 years ago
李培毅 ee998bf357 1
2 years ago
李培毅 f1d370e3d3 1
2 years ago
李培毅 0dc15346a5 1
2 years ago
李培毅 e794a118a2 1
2 years ago
p2i3t8vuh b4f33e0984 Merge pull request 'void' (#6) from ph6m83j2r/text4:void into 计算每个学生各门课程的总分和平均分
2 years ago
李培毅 ec3d6e02be 1
2 years ago
李培毅 2422e8cd31 1
2 years ago
p2i3t8vuh 68b7f765e8 Update README.md
2 years ago
李培毅 cfadf59ca7 1
2 years ago
李培毅 99a3f5bed2 1
2 years ago
李培毅 aa92df5cb3 学生成绩管理系统
2 years ago
wuhangkai 839d14ae24 df
2 years ago
p2i3t8vuh 59a91cab6e Merge pull request '1' (#5) from 阉割版程序 into master
2 years ago
p2i3t8vuh dcf309826e Merge pull request 'void' (#4) from ph6m83j2r/text4:void into 计算每个学生各门课程的总分和平均分
2 years ago
王振宇 b66dd3b676 1
2 years ago
wuhangkai 4ba7bfebc9 void
2 years ago
wuhangkai 63d3b5e77b void
2 years ago

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "c:/Users/lipei/Desktop/VSCode 2/text4",
"program": "c:/Users/lipei/Desktop/VSCode 2/text4/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

@ -0,0 +1,38 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wconversion",
"-Wnull-dereference",
"-Wsign-conversion"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false
}

28
.vscode/tasks.json vendored

@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "C:\\mingw64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}

@ -1,2 +1,110 @@
# text4
# 学生成绩管理系统
2023年4月23日
王振宇 李文菲 武杭凯 李培毅
## 项目简介
本学生成绩管理系统是为教师提供管理班级成绩的工具,该系统可以实现的对学生的成绩进行增,信息导入等基本功能,以及对学生成绩排序和分段的扩展功能,有利于对学生成绩管理。
下载地址https://bdgit.educoder.net/p2i3t8vuh/text4.git
项目开发过程中采用 Kanban (看板)进行任务管理和分工协作,并使用 Git 对程序代码和文档进行版本管理。任务分工情况如下:
|任务 |设计 |开发 |测试 |文档 |
|-----|-----|-----|-----|-----|
|驱动C1到C3及显示菜单并读取用户输入 ||||王振宇|
|显示菜单并获得用户键盘输入的选项||||李文菲|
|输入n个学生的m门课成绩 ||||武杭凯|
计算每个学生各门课程的总分和平均分 ||||李培毅|
每个成员的工作量(百分比):
|王振宇|李文菲|武杭凯|李培毅|
|------|------|------|------|
| 30 | 25 | 20 | 25 |
## 关于学生成绩管理系统
设计一个学生成绩管理系统,要求采用命令行菜单界面进行交互,具备读取、查询、修改、插入、删除和排序等基本功能,能够以表格和图表形式展示数据,采用 CSV 格式保存数据。
系统的功能性需求:
数据的读取、保存、打印、查询、修改、插入、删除、排序和图表展示。
系统的非功能性需求:
菜单驱动的命令行交互界面。
## 需求分析
分析系统的功能需求和界面需求,编制用户手册如下
#### C1启动程序
命令行中执行命令 ./app ,系统启动,显示提示信息,然后显示功能菜单,等待用户输入命令
~~~
库存管理系统启动
| 1 录入 | 2 计算 | 0 退出
请选择:
~~~
#### C2: 显示命令菜单
~~~
| 1 录入 | 2 计算 | 0 退出
请选择:
~~~
#### C3: 退出程序
选择菜单命令 0 ,退出程序
~~~
请选择0
程序退出
~~~
#### C4添加学生成绩
~~~
请选择1
输入学生序号1
输入学科序号4
输入成绩100
学生1成绩 已添加
| 1 录入 | 2 计算 | 0 退出
请选择: 1
输入学生序号1
输入学科序号4
学生成绩已存在
~~~
#### C5计算每个学生各门课程的总分和平均分
~~~
请选择2
输出序号1
输出各门课程的总分4100
输出各门课程的平均分4100
~~~
## 概要设计
系统主要分为用户界面和数据处理两大模块。
用户界面模块包括系统初始化init显示菜单display_menu选择菜单命令make_choice、确认confirm、退出quit等子模块。
数据处理模块包括数据输入(ReadScore),数据计算(AverSumofEveryStudent)等模块组成。
上述各模块通过主程序main进行调用系统模块图如下。
![](流程图.png)
各模块的主要功能如下:
#####main
系统主函数模块,显示菜单,根据用户选择的菜单命令,执行相关操作。
#####init
系统初始化。
#####display_menu
显示菜单命令。
####详细设计
![](text.drawio.svg)
#####add_data
Step 1: if 数据库满 then 提示数据库满并结束
Step 2: 输入零件编号
Step 3: if 学生成绩已存在 then 提示学生成绩已存在并结束
Step 4: 输入学生名和学科
Step 5: 添加新成绩到数据
Step 6: 提示添加成功
![](流程图2.png)

@ -0,0 +1,234 @@
<svg host="65bd71144e" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="591px" height="1011px" viewBox="-0.5 -0.5 591 1011" content="&lt;mxfile&gt;&lt;diagram id=&quot;3N_EoTLsvniCUdFc0R0G&quot; name=&quot;第 1 页&quot;&gt;7Vrdc+I2EP9b+sDM3QMz/gYeE0h7fbj2Wq7Tx4ywBWgiSz5ZDuH++q4sGdtI4ZiGmGTmniSvVtJ+/Ha1EozCef70m0DF9jPPMB0FXvY0ChejIPA9L4BGUfaaEidTTdgIkhmmlrAk33Ez01ArkuGyxyg5p5IUfWLKGcOp7NGQEHzXZ1tz2t+1QBtsEZYpojb1X5LJraZOg0lL/4TJZtvs7CczPZKjhtloUm5RxncdUng3CueCc6l7+dMcU2W8xi563q/PjB4EE5jJcyZEesIjopXRzcgl942yOAPdzSfjDJrbrcwpfPnQ1eyK51kJDKnklUgNl9lFIrHBhis8aA+wwTzHUuyBRWCKJHnsr46M/zYHvlZF6Bgt3RoHlsY5IszWmlJAk1J2tyUSLwtUy74DQLsM8IiFxE+nTWArZyZMDBhMNITmc9dCC0JG07YdWE29l1sjuY7/Q9v/8UD+Dy2NCSPS0hoCs1DdQvAUl+WPcbBC6cNG8Iplf1aSEmWnS+Ej6ePDjx0ACRwASS4AEN+21yAIiW2E+MFAEIktlTNSFhTt73PMqvcElcP3EFBxhNYgUPEdp0kwFFaazXv5pKggoXhwqMzz94SWcDokWrwroWXiyCyzodAysZT+Vr2v02c6JEj82RkgGbBSm/ZtMZvZtpg6TBFfIl7sU2mQeHHV6vraMESxfo7/h1J6OpTS9pGS1k1CQZTbskCsZ4HkW6Wui7crLjIsximnXIzCm3oF8WE87tI/1ibx2nTRZReb1YcgBpyBiF63Y2atOZPjNcoJ3esJc85KTkHXmhEkQbmKOSPPHAxKsICRP/DueFBPyTnjpQ7YwwZlfd1Xy/tR8VQPJIdJyUa1f2OULVMucGMTMKk2ix63MCK2PF9VZ+TRC+SIqJ8jIle+TF7pOhfY58sw8RI54iUZKF5C/+0oHXoDKe14ufmZJHpJ4gaieFnlfH0Hnf1SVply5htMGEE/YSSO95/A9f4zu0DCiOyzZpjYSezY0cXxELHjevUCWuh7Gj+nQ+goGDyN0qZ5Lgw+YfqIJUmRG8WBQbEZ0JuqEcZFjmhnDOKVIGgp2SBZCfUOfpIvRcVzLDuDJjUYeVp5j2IpIROoiCNsY8/kotgiZpYMNA3AL8cIJGKanILvIajbMcLq6KsHvUbVekQKWGwN6zc7MRPnAP/6ob6zzQ6SVF+ww1qgy+qBwHJqzVIK/oDHJoB6fKeSmt/ksrbzsSNphqHkACRyNpZbkj6w+mampqsXRNLY55i348uTfB1xenxrypE8No55kGrY6xtf4P1C8oILiZh0ZkR1QMw/L+7/+uf3r88mwm4ctN0rpse4nx4nE0c9Fb1SPRVeq56aOkqLoeqpZvOO0gIK7vsMSWRp/5ZeKoJZ1INK5Liev9pTRXil+3lTLfSgMtT9PLQf8RC4sFRlF1ZlV6nLrneAnaOnnSSK7SrMlWYugp0zfoZrjLVD+4KTOsOXD1imSjaVo3UtsUigW49jAXUvk6UxUU2rRYxvR/ECKGtC6VyfOYsMr1FVnwdQT5DvaFXvqpYVXILr2u8CCwL6qcN9oU/5Ly3ltmSo+Mq/aPkudgDM+q6JfVeBbHsmuER9/OK7JWbZjfrLQTv4P+PcUTG/OM7NVO2wzovvkcGPLanlMrNaY/5woeT4yqKVsRaqvXLQ57wQOuOfDD9D6OCIxJHdLhNC8Nn+fUU7sv0TUHj3Hw==&lt;/diagram&gt;&lt;/mxfile&gt;">
<defs/>
<g>
<path d="M 100 80 L 100 113.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 118.88 L 96.5 111.88 L 100 113.63 L 103.5 111.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<ellipse cx="100" cy="40" rx="50" ry="40" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 40px; margin-left: 51px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
main
</div>
</div>
</div>
</foreignObject>
<text x="100" y="44" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
main
</text>
</switch>
</g>
<path d="M 100 180 L 100 223.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 228.88 L 96.5 221.88 L 100 223.63 L 103.5 221.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="40" y="120" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 52 120 L 52 180 M 148 120 L 148 180" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 94px; height: 1px; padding-top: 150px; margin-left: 53px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
init
</div>
</div>
</div>
</foreignObject>
<text x="100" y="154" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
init
</text>
</switch>
</g>
<path d="M 100 290 L 100 343.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 348.88 L 96.5 341.88 L 100 343.63 L 103.5 341.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="40" y="230" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 52 230 L 52 290 M 148 230 L 148 290" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 94px; height: 1px; padding-top: 260px; margin-left: 53px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
display_menu
</div>
</div>
</div>
</foreignObject>
<text x="100" y="264" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
display_menu
</text>
</switch>
</g>
<path d="M 100 410 L 100 443.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 448.88 L 96.5 441.88 L 100 443.63 L 103.5 441.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="40" y="350" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 52 350 L 52 410 M 148 350 L 148 410" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 94px; height: 1px; padding-top: 380px; margin-left: 53px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
input n,m
</div>
</div>
</div>
</foreignObject>
<text x="100" y="384" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
input n,m
</text>
</switch>
</g>
<path d="M 100 910 L 100 953.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 958.88 L 96.5 951.88 L 100 953.63 L 103.5 951.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="40" y="850" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 52 850 L 52 910 M 148 850 L 148 910" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 94px; height: 1px; padding-top: 880px; margin-left: 53px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
quit
</div>
</div>
</div>
</foreignObject>
<text x="100" y="884" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
quit
</text>
</switch>
</g>
<ellipse cx="100" cy="985" rx="40" ry="25" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 100 530 L 100 593.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 598.88 L 96.5 591.88 L 100 593.63 L 103.5 591.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 180 490 L 267.63 490" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 272.88 490 L 265.88 493.5 L 267.63 490 L 265.88 486.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 100 450 L 180 490 L 100 530 L 20 490 Z" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 490px; margin-left: 21px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
c=
<span style="border-color: var(--border-color); background-color: rgb(255, 255, 255); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">
ReadScore
</span>
</div>
</div>
</div>
</foreignObject>
<text x="100" y="494" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
c=ReadScore
</text>
</switch>
</g>
<path d="M 100 690 L 100 733.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 738.88 L 96.5 731.88 L 100 733.63 L 103.5 731.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 200 645 L 253.63 645" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 258.88 645 L 251.88 648.5 L 253.63 645 L 251.88 641.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 100 600 L 200 645 L 100 690 L 0 645 Z" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 198px; height: 1px; padding-top: 645px; margin-left: 1px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
c=
<span style="border-color: var(--border-color); background-color: rgb(255, 255, 255); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px;">
AverSumofEveryStudent
</span>
</div>
</div>
</div>
</foreignObject>
<text x="100" y="649" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
c=AverSumofEveryStudent
</text>
</switch>
</g>
<path d="M 100 820 L 100 843.63" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 100 848.88 L 96.5 841.88 L 100 843.63 L 103.5 841.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 100 740 L 170 780 L 100 820 L 30 780 Z" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 138px; height: 1px; padding-top: 780px; margin-left: 31px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
<br/>
<span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: center; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(251, 251, 251); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">
c=CMD_QUIT
</span>
<div>
<br/>
</div>
<div>
<br/>
</div>
</div>
</div>
</div>
</foreignObject>
<text x="100" y="784" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
c=CMD_QUIT...
</text>
</switch>
</g>
<path d="M 394 490 L 573.63 490" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 578.88 490 L 571.88 493.5 L 573.63 490 L 571.88 486.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="274" y="460" width="120" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 286 460 L 286 520 M 382 460 L 382 520" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 94px; height: 1px; padding-top: 490px; margin-left: 287px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
read_data
</div>
</div>
</div>
</foreignObject>
<text x="334" y="494" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
read_data
</text>
</switch>
</g>
<path d="M 500 645 L 573.63 645" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 578.88 645 L 571.88 648.5 L 573.63 645 L 571.88 641.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<rect x="260" y="615" width="240" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
<path d="M 284 615 L 284 675 M 476 615 L 476 675" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 190px; height: 1px; padding-top: 645px; margin-left: 285px;">
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
aversumofeverystudent_data
</div>
</div>
</div>
</foreignObject>
<text x="380" y="649" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
aversumofeverystudent_data
</text>
</switch>
</g>
<ellipse cx="580" cy="490" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="none" pointer-events="all"/>
<rect x="570" y="480" width="20" height="20" fill="none" stroke="none" pointer-events="all"/>
<path d="M 580 490 L 580 645" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
<ellipse cx="580" cy="645" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="none" pointer-events="all"/>
<rect x="570" y="635" width="20" height="20" fill="none" stroke="none" pointer-events="all"/>
</g>
<switch>
<g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
<a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank">
<text text-anchor="middle" font-size="10px" x="50%" y="100%">
Text is not SVG - cannot display
</text>
</a>
</switch>
</svg>

After

Width:  |  Height:  |  Size: 22 KiB

14
void

@ -0,0 +1,14 @@
// 函数功能输入n个学生的m门课成绩
void ReadScore(STU stu[], int n, int m)
{
int i, j;
printf("Input student's ID, name and score:\n");
/* ---------- begain ---------- */
for(i=0;i<n;i++)
{scanf("%ld%s",&stu[i].num,stu[i].name);
for (j=0; j<m; j++)
scanf("%f",&stu[i].score[j]);
}
/* ----------- end ----------- */
}

@ -0,0 +1,83 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LEN 10 // 字符串最大长度
#define STU_NUM 30 // 最多的学生人数
#define COURSE_NUM 6 // 最多的考试科目数
typedef struct student
{
long num; // 每个学生的学号
char name[MAX_LEN]; // 每个学生的姓名
float score[COURSE_NUM]; // 每个学生COURSE_NUM门功课的成绩
float sum; // 每个学生的总成绩
float aver; // 每个学生的平均成绩
}STU;
int Menu(void);
void ReadScore(STU stu[], int n, int m);
void AverSumofEveryStudent(STU stu[], int n, int m);
int main(void)
{
char ch;
int n = 0, m = 0;
STU stu[STU_NUM];
printf("Input student number(n<%d):", STU_NUM);
scanf("%d", &n);
printf("Input course number(m<=%d):",COURSE_NUM);
scanf("%d", &m);
while (1)
{
ch = Menu(); // 显示菜单,并读取用户输入
switch (ch)
{
case 1:ReadScore(stu, n, m);
break;
case 2: AverSumofEveryStudent(stu, n, m);
break;
case 0: printf("End of program!");
exit(0);
default:printf("Input error!");
}
}
return 0;}
// 函数功能:显示菜单并获得用户键盘输入的选项
int Menu(void)
{
int itemSelected;
printf("Management for Students' scores\n");
printf("1.Input record\n");
printf("2.Calculate total and average score of every course\n");
printf("0.Exit\n");
printf("Please Input your choice:");
scanf("%d", &itemSelected); // 读入用户输入
return itemSelected;
}
// 函数功能输入n个学生的m门课成绩
void ReadScore(STU stu[], int n, int m)
{
int i, j;
printf("Input student's ID, name and score:\n");
/* ---------- begain ---------- */
for(i=0;i<n;i++)
{scanf("%ld%s",&stu[i].num,stu[i].name);
for (j=0; j<m; j++)
scanf("%f",&stu[i].score[j]);
}
/* ----------- end ----------- */
}
// 函数功能:计算每个学生各门课程的总分和平均分
void AverSumofEveryStudent(STU stu[], int n, int m)
{
int i, j;
for (i=0; i<n; i++)
{
stu[i].sum = 0;
for (j=0; j<m; j++)
{
stu[i].sum = stu[i].sum + stu[i].score[j];
}
stu[i].aver = m>0 ? stu[i].sum / m : -1;
printf("student %d: sum = %.0f, aver = %.0f\n",
i+1, stu[i].sum, stu[i].aver);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Loading…
Cancel
Save