学生成绩分析管理系统.docx
《学生成绩分析管理系统.docx》由会员分享,可在线阅读,更多相关《学生成绩分析管理系统.docx(52页珍藏版)》请在冰豆网上搜索。
![学生成绩分析管理系统.docx](https://file1.bdocx.com/fileroot1/2022-12/13/bc9616e0-9bb5-4089-ad79-c7d59fd228bb/bc9616e0-9bb5-4089-ad79-c7d59fd228bb1.gif)
学生成绩分析管理系统
C++课程设计说明书
学生成绩管理分析系统
姓名:
宁新丽
学号:
069109141
班级:
09级网工五班
指导老师:
张晓民
一,目的与要求
1.1目的
1.2要求
二,需求分析
2.1功能分析
2.2数据结构设计
2.3界面设计
2.4数据存储
2.5详细设计
三,类图
四,编码
五,测试的步骤和内容
六,课程设计总结
七,参考文献
一、目的与要求
1.目的:
(1)巩固C++基础知识;
(2)能够运用面向对象方法进行类的设计;
(3)锻炼学生编程能力,解决实际问题的能力。
2.要求
基本要求:
(1)按照软件开发流程进行开发
(2)类的设计合理;包括类的继承多态等;
(3)模块划分清晰合理;
(4)实用性好。
二,需求分析
2.1功能分析
(1),定义类
视图类(View):
数据成员:
charMsg;//获取操作命令
boolflag;//判断操作是否正确
chartel[50];//是否错误通知
characcount[20];//账号或学号
structstudent*p;//用于链表寻找节点
structstudent*q;//用于链表寻找节点
成员函数:
DisplayChoose(charid[][20],charn);//选择界面显示
DisplayChoose(chartel[]);//老师登陆
DisplayList(structstudent*t);//列表界面
DisplayAnalysis(charid[][20]);//分析界面
DisplayAdd(structstudent*head);//添加界面
DisplayOperate(structstudent*t);//修改界面
DisplayDelete(structstudent*t);//删除界面
DisplayExit();//关闭界面
模型类-后台运算(Model):
数据成员:
boolflag;//判断操作是否正确
characcount[20];//账号和密码
structstudenthead;//头链表
structstudentt;//临时结构体
structstudent*p;//用于链表寻找节点
structstudent*q;//用于链表寻找节点
成员函数:
boolLogin(characcount[]);//登陆
structstudent*LoadData();//数据加载
voidQuery(structstudent*Head,characcount[20],charMsg);//查询数据
voidAnalysis(structstudent*head,charMsg);//分析数据
structstudent*Ranking(structstudent*head,charMsg);//排名数据
voidQuit(structstudent*head);//退出
friendclassController;//私有方法充许Controller类调用的声明
voidAddData(structstudent*head,structstudent*t);//添加数据
boolUpData(structstudent*head,structstudent*t,characcount[]);//更新数据
boolDeleteDate(structstudent*head,characcount[]);//删除数据
boolSaveDate(structstudent*head);//保存数据
控制器--逻辑控制(Controller):
数据成员:
boolflag;//判断操作是否正确
charMsg;//获取操作命令
chartel[50];//是否错误通知
characcount[20];//账号或学号
charid[5][20];//选择项
structstudent*head;//链表头
成员函数:
voidLogin();//登陆
voidMenu(charMsg);//主菜单
voidOperate(structstudent*head);//操作
voidQuery(structstudent*head);//查找
voidAnalysis(structstudent*head);//分析
voidRanking(structstudent*head);//排名
voidQuit(structstudent*head);//退出
2.2数据结构设计
利用结构体创建链表用来保存提取的学生信息
结构体如下:
structstudent
{
charStuNo[12];//学号
charName[20];//姓名
charMajors[20];//系别
charClas[20];//班级
intgrade[4];//成绩----5科成绩
structstudent*next;
};
2.3.界面设计(UI)字符界面
选择登陆权限界面
老师登陆界面
老师主菜单
学生界面
退出界面
2.4数据存储(Datastorage)
数据以文件形式存储,以二进制形式顺序存储在一个文件中,是student.txt,用与存储学生成绩信息。
2.5详细设计(Detailfunction)
系统流程图
学生操作流程图
老师操作流程图
查看流程图
分析流程图
排名流程图
添加流程图
修改流程图
删除流程图
三,类图(Classdiagram)
四,编码
●Controller.h
#include"iostream"
#include"fstream"
#include"iomanip"
#include"string"
#include"windows.h"
#include"Model.h"
usingnamespacestd;
classController:
publicView,Model//控制流程
{
public:
voidLogin();//登陆
voidMenu(charMsg);//主菜单
voidOperate(structstudent*head);//操作
boolQuery(structstudent*head);//查找
voidAnalysis(structstudent*head);//分析
voidRanking(structstudent*head);//排名
voidQuit(structstudent*head);//退出
private:
boolflag;//判断操作是否正确
chartel[50];//是否错误通知
characcount[20];//账号认证
charadmin[20];//账号
charid[5][20];//选择项
doubleresult[25];//分析结果
structstudent*t;
structstudent*head;
};
●Model.h
#include"iostream"
#include"fstream"
#include"iomanip"
#include"string"
#include"windows.h"
#include"View.h"
usingnamespacestd;
classModel//运算
{
public:
boolLogin(characcount[20],charadmin[20]);//登陆
structstudent*LoadData();//数据加载
structstudent*Query(structstudent*Head,characcount[20],charMsg);//查询数据
voidAnalysis(structstudent*head,charMsg,characcount[20],double*result);//分析数据
structstudent*Ranking(structstudent*head,charMsg,characcount[20]);//排名数据
voidQuit(structstudent*head);//退出
private:
friendclassController;//私有方法充许Controller类调用的声明
char*LoadAdmin();//加载老师账号
voidSaveAdmin(characcount[20]);//保存老师帐号
voidAddData(structstudent*head,structstudent*t);//添加数据
voidUpData(structstudent*head,structstudent*t,characcount[20]);//更新数据
voidDeleteData(structstudent*head,characcount[]);//删除数据
voidSaveData(structstudent*head);//保存数据
boolflag;//判断操作是否正确
characcount[20];//账号和密码
structstudenthead;
structstudentt;
structstudent*c;
structstudent*p;
structstudent*q;
};
●student.h
#include"iostream"
#include"fstream"
#include"iomanip"
#include"string"
#include"windows.h"
usingnamespacestd;
//定义结构体
structstudent
{
charStuNo[12];//学号
charName[20];//姓名
charMajors[20];//系别
charClas[20];//班级
doublegrade[4];//成绩----4科成绩
structstudent*next;
};
●View.h
#include"iostream"
#include"fstream"
#include"iomanip"
#include"string"
#include"windows.h"
#include"student.h"
usingnamespacestd;
classView//显示
{
public:
charDisplayChoose(charid[][20],charn);//选择界面显示
char*DisplayChoose(chartel[]);//老师登陆
boolDisplayList(structstudent*t);//列表界面
voidDisplayAnalysis(double*result);//分析界面
boolDisplayEnquire();//询问是否继续
char*DisplayIn();//输入条件
char*DisplayIn(structstudent*head);//输入条件
structstudent*DisplayAdd(structstudent*head);//添加界面
structstudent*DisplayUpdata(structstudent*head,characcount[20]);//修改界面
boolDisplayDelete();//删除界面
voidDisplayExit();//退出界面
voidDisplayWelcome();//欢迎页面
voidDisplayError();//错误页面
private:
charMsg;
boolflag;
chartel[50];
characcount[20];//账号和密码
structstudent*p;
structstudent*q;
};
●学生成绩管理分析系统.cpp
#include"iostream"
#include"fstream"//输入输出流的头文件
#include"iomanip"//iomanip.h是I/O流控制头文件,就像C里面的格式化输出一样
#include"string"
#include"windows.h"
#include"Controller.h"
usingnamespacestd;
charView:
:
DisplayChoose(charid[][20],charn)//选择界面显示
{
Msg='0';
strcpy(tel,"");
while(Msg=='0')//Msg='0'故恒为真
{
DisplayWelcome();
cout<<"\n\t\t\t\t︳\n"
<<"\t\t\t"<<<"\t\t\t\t︳\n"
<<"\t\t\t\t︳\n"
<<"\t\t---------------------------------\n"
<<"\t\t\t\t︳\n"
<<"\t\t\t\t︳\n"
<<"\t\t\t"<<<"\t\t\t\t︳\n\n\n"
<<<"您当前的状态——"<<<"请输入数字然后按ENTER:
";
Msg=getchar();
fflush(stdin);//刷新缓冲区,防止输入过多数据
if(Msg<='0'||Msg>n){
Msg='0';
strcpy(tel,"\t\t\t输入错误!
请重新输入!
");
}
}
returnMsg;
}
char*View:
:
DisplayChoose(chartel[])//老师登陆界面
{
DisplayWelcome();
cout<";
cin>>account;//account账号/密码
fflush(stdin);
returnaccount;
}
boolView:
:
DisplayList(structstudent*t)//列表界面
{
p=t;
intn=0;
if(p->next!
=NULL)
{
DisplayWelcome();
cout<<"\t╔══╦══╦══╦══╦══╦══╦══╦══╦══╗\n"
<<"\t║编号║学号║姓名║系别║班级║语文║数学║理综║英语║\n"
<<"\t╠══╬══╬══╬══╬══╬══╬══╬══╬══╣\n";
while(p->next!
=NULL)
{
n++;
p=p->next;
cout<<"\t║"<StuNo<<"║"
<Name<<"║"<Majors<<"║"
<Clas<<"║"<grade[0]<<"║"
<grade[1]<<"║"<grade[2]<<"║"
<grade[3]<<"║\n";
if(p->next!
=NULL)
cout<<"\t╠══╬══╬══╬══╬══╬══╬══╬══╬══╣\n";
else
cout<<"\t╚══╩══╩══╩══╩══╩══╩══╩══╩══╝\n";
}
flag=true;
}
else
{
cout<<"\n\n\n\t\t\t没有数据!
";
flag=false;
}
system("pause");//暂停命令行里输出一行类似于“Pressanykeytoexit”的字,等待用户按一个键,然后返回。
returnflag;
}
voidView:
:
DisplayAnalysis(double*result)//分析界面
{
DisplayWelcome();
cout<<"\t\t科目\t及格率\t优秀率\t最高分\t最低分\t平均成绩\n\n";
cout.precision
(2);//保留两位小数
cout<<"\t\t语文\t"<cout<<"\t\t数学\t"<cout<<"\t\t理综\t"<cout<<"\t\t英语\t"<cout<<"\t\t汇总\t"<system("pause");
}
boolView:
:
DisplayEnquire()//询问是否继续
{
cout<<"是否继续?
请输入Y/N后,按ENTER键:
";
cin>>Msg;
fflush(stdin);
returnMsg=='Y'||Msg=='y'?
true:
false;
}
char*View:
:
DisplayIn()//输入条件
{
cout<<"\t\t\t请输入条件,然后按ENTER:
";
cin>>account;
fflush(stdin);
returnaccount;
}
char*View:
:
DisplayIn(structstudent*head)//输入条件
{
flag=false;
cout<<"\t\t\t";
while(!
flag)
{
cout<<"输入学号然后按ENTER:
";
cin>>account;
fflush(stdin);
p=head;
while(p->next!
=NULL)
{
p=p->next;
if(strcmp(account,p->StuNo)==0)
{
flag=true;
break;
}
}
if(!
flag)
cout<<"\t\t学号输入错误,请重新";
}
returnaccount;
}
structstudent*View:
:
DisplayAdd(structstudent*head)//添加界面
{
flag=true;
q=(structstudent*)malloc(sizeof(structstudent));
DisplayWelcome();
cout<<"\t\t\t";
while(flag){
flag=false;
cout<<"输入学号然后按ENTER:
";
cin>>q->StuNo;
p=head;
while(p->next!
=NULL)
{
p=p->next;
if(strcmp(q->StuNo,p->StuNo)==0)//看是不是与添加的学号相同
{
cout<<"\t\t输入学号重复,请重新";
flag=true;
break;
}
}
}
cout<<"\t\t\t输入姓名然后按ENTER:
";
cin>>q->Name;
cout<<"\t\t\t输入系别然后按ENTER:
";
cin>>q->Majors;
cout<<"\t\t\t输入班级然后按ENTER:
";
cin>>q->Clas;
cout<<"\n\n\t\t\t输入语文然后按ENTER:
";
cin>>q->grade[0];
cout<<"\t\t\t输入数学然后按ENTER:
";
cin>>q->grade[1];
cout<<"\t\t\t输入理综然后按ENTER:
";
cin>>q->grade[2];
cout<<"\t\t\t输入英语然后按ENTER:
";
cin>>q->grade[3];
fflush(stdin);
q->next=NULL;
returnq;
}