1、 /同学评分 int gradeTeacher; /老师评分 int gradeEthic; /道德评分 double gradeAll; /综合成绩 int rankAll; /综合排名public: Student(); /默认构造函数 void Student_WritePersonalInformation(char *iD, char *nam, char *add, char *tel); /更改学生信息 void Student_WriteMaPhEgGrade(int graMa, int graPh, int graEg); /更改学生考试成绩 void Student_Wr
2、iteOtherGrade(int graCl, int graTe, int graEth); /更改学生其他成绩 void Student_DisplayInformation(); /显示学生信息 char *Student_ReadID(); double Student_ReadGrade(); double Student_ReadTotalGrade(); int Student_ReadGradeRank(); int Student_ReadTotalGradeRank(); void Student_WriteGradeRank(int ranGr); /更改学生成绩排名
3、void Student_WriteTotalGradeRank(int ranAl); /更改学生综合排名 char *Student_ReadName();Student:Student() /默认构造函数 strncpy_s(idNumber, 000000000000,12); strncpy_s(name,空,30); strncpy_s(address, , 50); strncpy_s(telephone, , 14); gradeMath=0; gradePhysics=0; gradeEnglish=0; gradeMaPhEgAverage=0; rankGrade=0;
4、gradeClassmate=0; gradeTeacher=0; gradeEthic=0; gradeAll=0; rankAll=0; void Student:Student_WritePersonalInformation(char *iD, char *nam, char *add, char *tel) strncpy_s(idNumber,iD,12); strncpy_s(name, nam, 30); strncpy_s(address, add,50); strncpy_s(telephone, tel, 14);Student_WriteMaPhEgGrade(int
5、graMa, int graPh, int graEg) gradeMath = graMa; gradePhysics = graPh; gradeEnglish = graEg; gradeMaPhEgAverage = (gradeMath + gradePhysics + gradeEnglish) / 3;Student_WriteOtherGrade(int graCl, int graTe, int graEth) gradeClassmate = graCl; gradeTeacher = graTe; gradeEthic = graEth; gradeAll = grade
6、MaPhEgAverage*0.6 + gradeClassmate*0.1 + gradeEthic*0.1 + gradeTeacher*0.2;Student_WriteGradeRank(int ranGr) rankGrade = ranGr;Student_WriteTotalGradeRank(int ranAl) rankAll = ranAl;Student_DisplayInformation() using namespace std; cout - endl; 学生信息 姓名: name endl 学号: idNumber 地址: address 电话: telepho
7、ne 数学成绩: gradeMath 物理成绩: gradePhysics 英语成绩: gradeEnglish 三科平均成绩: gradeMaPhEgAverage 学习成绩排名: rankGrade 同学评价得分: gradeClassmate 教师评价得分: gradeTeacher 道德修养评分: gradeEthic 综合成绩: gradeAll 综合成绩排名: rankAll -char *Student:Student_ReadID() return idNumber;double Student:Student_ReadGrade() return gradeMaPhEgAve
8、rage;Student_ReadTotalGrade() return gradeAll;int Student:Student_ReadGradeRank() return rankGrade;Student_ReadTotalGradeRank() return rankAll;namespace studentInformation std:vector studentVector; int flagStudentChoose=0; int flagStudentFound=1;Student_ReadName() return name;/-以上是基本数据结构的定义,同时定义了对数据
9、的基本操作。定义完毕了,接下来是功能函数-void MainMenu();void EditMenu();void AddStudentPersonalInformation(int mode);void ModifyStudentInformation();void SearchStudent();void DeleteStudentInformation();void DisplayStudentInformation();void RankByGrade();void RankByTotalGrade();void RankByID();bool CmpGrade(Student stu
10、dent1,Student student2); /这个函数的参数是两个Student类的对象bool CmpTotalGrade(Student student1, Student student2);bool CmpID(Student student1, Student student2);void DisplayAllStudentInformation();/-以下是主菜单界面函数-void MainMenu() int flagOperateInformation = 1; while (flagOperateInformation) using namespace std; co
11、ut -欢迎进入学生信息管理系统V1.0. endl 按下1:进入学生信息管理系统.按下0:退出. endlendl flagOperateInformation; cin.clear(); if (flagOperateInformation) EditMenu(); /-主菜单界面函数定义完毕-/-以下是编辑界面函数-void EditMenu() int flagContinueOperation = 1; while (flagContinueOperation) flagContinueOperation = 0;- 主菜单 添加学生信息.按下2:修改学生信息.按下3:删除学生信息.
12、按下4:显示学生信息.按下5:按学号升序排序按下6:读入已有信息(暂时没实现)按下7:将信息输出(暂时没实现)按下8:显示系统内所有学生的信息返回上一级. flagContinueOperation; switch (flagContinueOperation) case 1:AddStudentPersonalInformation(1); break; case 2:ModifyStudentInformation(); case 3:DeleteStudentInformation(); case 4:DisplayStudentInformation(); case 5:RankByI
13、D(); case 6:cout flagAddPersonalInformation; cin.clear(); if (flagAddPersonalInformation) char name30; char iD13; char address50; char phone14;请输入学生姓名:; name;请输入学生学号: iD;请输入学生地址: address;请输入学生电话: phone; studentInformation:studentVectorcurrentObjectPosition.Student_WritePersonalInformation(iD,name,ad
14、dress,phone);基本信息输入成功! - /- 学习成绩 录入学生学习成绩;跳过学习成绩信息。 flagAddGrade; if (flagAddGrade) int mathGrade; int physicsGrade; int englishGrade;请输入数学成绩: mathGrade;请输入物理成绩: physicsGrade;请输入英语成绩: englishGrade;studentVectorcurrentObjectPosition.Student_WriteMaPhEgGrade(mathGrade, physicsGrade, englishGrade);学习成绩
15、输入成功! /- 其他成绩 录入学生其他成绩;跳过其他成绩信息。 int peerGrade; int teacherGrade; int ethicGrade;请输入同学评议成绩: peerGrade;请输入教师评议成绩: teacherGrade;请输入道德测评成绩成绩: ethicGrade;studentVectorcurrentObjectPosition.Student_WriteOtherGrade(peerGrade, teacherGrade, ethicGrade);其他成绩输入成功! RankByGrade(); RankByTotalGrade();学生成绩录入成功!void SearchStudent() using namespace studentInformation; char ID13;请输入学生的学号: ID; int vectorSize = studentVector.size(); int i = 0; while (ivectorSize) & (flagStudentFound!=0) flagStudentFound = strcmp(ID, studentVector
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1