C++實(shí)現(xiàn)教務(wù)管理系統(tǒng)
更新時間:2022年06月20日 10:30:47 作者:Demo龍
這篇文章主要為大家詳細(xì)介紹了C++實(shí)現(xiàn)教務(wù)管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了C++實(shí)現(xiàn)教務(wù)管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
gradeInfo.cpp
#include <iostream> #include <string> #include <sstream>//stringstream字符串流需要引用的庫? #include <fstream> #include "gradeInfo.h" using namespace std; //構(gòu)造函數(shù)初始化數(shù)據(jù)? gradeInfo::gradeInfo()? { ?? ?studentNumber = new string[200]; ?? ?grade = new double[200]; ?? ?courseNumber = ""; ?? ?studentNum = 0; } //錄入學(xué)生信息? void gradeInfo::setGradeInfo(string courseNumber,int studentNum) { ?? ?for (int i = 0; i < studentNum; i++) ?? ? ? ?grade[i] = 0; ?? ?this->courseNumber = courseNumber; ?? ?this->studentNum = studentNum; } //錄入學(xué)生成績? void gradeInfo::setGrade() { ?? ?cout << "請開始輸入學(xué)生成績:" << endl << endl; ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?cout << studentNumber[i] << " ? : ?"; ?? ??? ?cin >> grade[i]; ?? ?} } //根據(jù)學(xué)號查詢某同學(xué)的成績及分?jǐn)?shù)? void gradeInfo::searchSingleGrade(string new_studentNumber) const { ?? ? ? ?for (int i = 0; i < studentNum; i++) ?? ? ? ?{ ?? ? ? ??? ?if (new_studentNumber == studentNumber[i]) ?? ??? ? ? ? ? ?cout << " ?學(xué)號:" << studentNumber[i] << " ?課程成績:" << grade[i] << endl << endl; ?? ? ? ?} } //查詢所有成績分?jǐn)?shù)? void gradeInfo::searchAllGrade(student * s, int totalSNum) const { ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?for (int k = 0; k < totalSNum; k++) ?? ??? ?{ ?? ??? ? ? ?if (studentNumber[i] == s[k].getStudentNumber()) ?? ??? ? ? ? ?cout << "學(xué)號 ? ?: " << studentNumber[i] << " ? 姓名 ?: " << s[k].getName() << " ?成績: " << grade[i] << " ? ? ? "<< endl; ?? ??? ?} ?? ?} ?? ?cout << endl; } //返回課程數(shù)目? string gradeInfo::getCourseNumber() const? { ?? ?return courseNumber; }? //返回學(xué)生數(shù)目? int gradeInfo::getStudentNum() { ?? ?return studentNum; }? //將成績及數(shù)據(jù)寫入文件? void gradeInfo::writeToTxtFileG(int num) const { ?? ?string fileName ( "grade"); ? ? stringstream ss;//stringstream文件流的輸入輸出操作 ? ? ss << num; ?? ?fileName.append(ss.str());//ss.str()轉(zhuǎn)換成末尾為/0的字符串?dāng)?shù)組? ?? ?fileName.append(".txt"); ?? ? ?? ?ofstream txtOut(fileName.c_str());//c_str():生成一個const char*指針,指向以空字符終止的數(shù)組。 ?? ? ?? ?txtOut << courseNumber << " ?" << studentNum << endl; ?? ? ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?txtOut << studentNumber[i] << " ?" << grade[i] << endl; ?? ?} ?? ? ?? ?txtOut.close(); } //從文件中讀取學(xué)號及成績? void gradeInfo::readFromTxtFileG(int num) ? { ?? ?string fileName ( "grade"); ? ? stringstream ss; ? ? ss << num; ?? ?fileName.append(ss.str());//.str()返回一個以‘/0'結(jié)尾的字符數(shù)組 ?? ?fileName.append(".txt"); ?? ? ?? ?fstream txtIn(fileName.c_str(), ios::in);? ? ? txtIn >> courseNumber >> studentNum; ?? ? ?? ?for (int i = 0; i < studentNum; i++)? ? ? ? ? txtIn >> studentNumber[i] >> grade[i]; ? ?? ? ? txtIn.close(); } //根據(jù)學(xué)生數(shù)據(jù)判斷是否存在學(xué)生? bool gradeInfo::isStudentHere(string new_studentNumber) { ?? ?bool temp = false; ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?if (new_studentNumber == studentNumber[i]) ?? ??? ? ? ?temp = true; ?? ?} ?? ?return temp; } //析構(gòu)函數(shù)? gradeInfo::~gradeInfo() { ?? ?delete [] studentNumber; ?? ?delete [] grade; }
gradeInfo.h
#include <string> #include "student.h" using namespace std; class ?gradeInfo { public: ?? ?string * studentNumber;//學(xué)號 ?? ?string courseNumber;//課程編號 ?? ?double * grade;//成績 ?? ?int studentNum;//課程學(xué)生數(shù)? ?? ?friend class teacher; ?? ?gradeInfo();//默認(rèn)構(gòu)造函數(shù) ?? ?void setGradeInfo(string courseNumber, int studentNum);//設(shè)置初始化成績信息對象? ?? ?void setGrade();//錄入成績? ?? ?void searchSingleGrade(string studentNumber) const;//利用學(xué)號查詢成績? ?? ?void searchAllGrade(student * s, int totalSNum) const;//輸出全體學(xué)生成績? ?? ?string getCourseNumber() const;//獲取課程編號? ?? ?int getStudentNum();//獲取學(xué)生數(shù)? ?? ?void writeToTxtFileG(int) const; ?? ?void readFromTxtFileG(int);? ?? ?bool isStudentHere(string new_studentNumber);//判斷學(xué)生是否有相應(yīng)課程編碼的課? ?? ?~gradeInfo(); //刪除學(xué)號和成績指針? };
classInfo.cpp
#include <iostream> #include <fstream> #include <string> #include "classInfo.h" using namespace std; //構(gòu)造函數(shù)初始化課程數(shù)據(jù)? classInfo::classInfo() { ?? ?courseNumber = ""; ?? ?courseName = ""; ?? ?credit = 0 ; ?? ?jobNumberOfTeacher = ""; } //錄入課程數(shù)據(jù)? void classInfo::setClassInfo(string courseNumber, string courseName, double credit, string jobNumberOfTeacher) { ?? ?this->courseNumber = courseNumber; ?? ?this->courseName = courseName; ?? ?this->credit= credit; ?? ?this->jobNumberOfTeacher = jobNumberOfTeacher; } //展示課程數(shù)據(jù)? void classInfo::searchBasicInfo() const { ?? ?cout <<"課程編號:" << courseNumber << " ?" << "課程名稱:" << courseName << " ?學(xué)分: " << credit << endl; } //返回教師工號? string classInfo::getJobNumberOfTeacher() const { ?? ?return jobNumberOfTeacher;? } //返回課程代碼? string classInfo::getCourseNumber() const { ?? ?return courseNumber; } //返回課程學(xué)分? double classInfo::getCredit() const { ?? ?return credit;? }? //返回課程名? string classInfo::getCourseName() const { ?? ?return courseName; } //將課程信息錄入文件? void classInfo::writeToTxtFileC() const { ?? ?ofstream txtOut("classBasicInfo.txt", ios::app); ?? ? ?? ?txtOut << courseNumber << " ?" << courseName << " ?" << credit << " ?" << jobNumberOfTeacher << endl; ?? ? ?? ?txtOut.close(); } //從文件中讀取課程信息? void classInfo::readFromTxtFileC(int num) { ?? ?fstream txtIn("classBasicInfo.txt", ios::in); ?? ?string temp; ?? ?int line = 1; ?? ?if(num == 1) ?? ??? ?txtIn >> courseNumber >> courseName >> credit >> jobNumberOfTeacher ; ?? ?else ?? ?{ ?? ??? ?while(getline(txtIn, temp, '\n')) ?? ??? ?{ ?? ??? ??? ?line++; ?? ??? ??? ?if(line == num) ?? ??? ??? ??? ?txtIn >> courseNumber >> courseName >> credit >> jobNumberOfTeacher ; ?? ??? ?} ?? ?} ?? ? ?? ?txtIn.close(); }
classInfo.h
#ifndef CLASSINFO_H #define CLASSINFO_H #include <string> using namespace std; class ?classInfo { protected: ?? ?string courseNumber;//課程編號 ?? ?string courseName;//課程名稱 ?? ?double credit;//學(xué)分 ?? ?string jobNumberOfTeacher;//任課老師工號 public: ?? ?friend class systemAdmin; ?? ?classInfo();//默認(rèn)構(gòu)造函數(shù) ?? ?void setClassInfo(string courseNumber, string courseName, double credit, string jobNumberOfTeacher);//設(shè)置課程信息? ?? ?void searchBasicInfo() const;//輸出課程信息 ?? ?string getJobNumberOfTeacher() const;//獲取任課教師工號 ?? ?string getCourseNumber() const;//獲取課程編號 ?? ?string getCourseName() const;//獲取課程名稱 ?? ?double getCredit() const;//獲取學(xué)分? ?? ?void writeToTxtFileC() const;//向文件中寫入數(shù)據(jù)? ?? ?void readFromTxtFileC(int);//從文件中讀取數(shù)據(jù)? }; #endif // !CLASSINFO_H
user.cpp
#include "user.h" #include <string> #include <iostream> using namespace std; //構(gòu)造函數(shù)初始化數(shù)據(jù)? user::user()? { ?? ?password = "zal222";//初始密碼為zal222 ?? ?name = ""; ?? ?sex = ""; ?? ?birth = ""; ?? ?politicStatus = ""; ?? ?address = ""; } //修改初始密碼? void user::changePassword() { ?? ?string new_password, original_password, new_password1; ?? ?cout << ?endl << "請輸入原密碼 ? ?: "; ?? ?cin >> original_password; ?? ?while (password != original_password) ?? ?{ ?? ??? ?cout << "原密碼輸入錯誤,請重新輸入: "; ?? ??? ?cin >> original_password; ?? ?} ?? ?while (password == original_password) ?? ?{ ?? ??? ?cout << "請輸入新密碼 ? ?: "; ?? ??? ?cin >> new_password; ?? ??? ?cout << "請再次輸入新密碼: "; ?? ??? ?cin >> new_password1; ?? ??? ?if (new_password == new_password1) ?? ??? ?{ ?? ??? ??? ?password = new_password; ?? ??? ??? ?break; ?? ??? ?} ?? ??? ?else ?? ??? ??? ?cout << "兩次次新密碼不一致,請重新輸入!" << endl; ?? ?} ?? ?cout << "\t\t\t\t\t ?你的密碼修改成功,請重新登錄!" << endl; } //返回密碼 string user::getPassword() const//函數(shù)不可以修改class的成員? { ?? ?return password; } //返回用戶名(管理員)? string user::getUserName() const//函數(shù)不可以修改class的成員 { ?? ?return userName; }
user.h
#ifndef USER_H #define USER_H #include <string> using namespace std; class user { ? ?? public: ?? ?string password;//密碼最長為15位? ?? ?string userName;//用于管理員的用戶名? ?? ?string name;//姓名? ?? ?string sex;//性別? ?? ?string birth;//生日? ?? ?string politicStatus;//政治面貌? ?? ?string address;//地址? ?? ?user(); ?? ?void changePassword();//修改初始密碼? ?? ?string getPassword() const;//返回密碼 ?? ?string getUserName() const;//返回用戶名(管理員)? ?? ?//由于教務(wù)系統(tǒng)的特殊性,不用自己注冊賬號? }; #endif
student.cpp
#include <string> #include <fstream> #include <iostream> #include "student.h" using namespace std; //構(gòu)造函數(shù)? student::student()? { ?? ?studentNumber = ""; ?? ?majorAndClass = ""; } //設(shè)置學(xué)生基礎(chǔ)信息 void student::setStudentBasicInfo(string new_studentNumber, string new_name, string new_sex, string new_majorAndClass, string new_birth, string new_politicStatus, string new_address) { ?? ?studentNumber = new_studentNumber; ?? ?name = new_name; ?? ?sex = new_sex; ?? ?majorAndClass = new_majorAndClass; ?? ?birth = new_birth; ?? ?politicStatus = new_politicStatus; ?? ?address = new_address; } //查詢基礎(chǔ)信息 void student::searchBasicInfo() const { ?? ?cout << endl << "\t學(xué)號:" << studentNumber << " ?" << "姓名:" << name << " ?" << "性別:" << sex << " ?" << "專業(yè)班級:" << majorAndClass << " ?" << "生日:" << birth << " ?" << "政治面貌:" << politicStatus << " ?" << "家庭地址:" << address << endl; } //返回學(xué)號 string student::getStudentNumber() const { ?? ?return studentNumber; } //返回姓名? string student::getName() { ?? ?return name; } //向文件中寫入數(shù)據(jù)? void student:: writeToTxtFileS() const { ?? ?ofstream txtOut("studentBasicInfo.txt", ios::app); ?? ? ?? ?txtOut << studentNumber << " ?" << password << " ?" << name << " ?" << sex << " ?" << majorAndClass << " ?" << birth << " ?" << politicStatus << " ?" << address << endl; ?? ? ?? ?txtOut.close(); } //從文件中讀取數(shù)據(jù)? void student::readFromTxtFileS(int num) { ?? ?fstream txtIn("studentBasicInfo.txt", ios::in); ?? ?string temp; ?? ?int line = 1; ?? ?if(num == 1) ?? ??? ?txtIn >> studentNumber >> password >> name >> sex >> majorAndClass >> birth >> politicStatus >> address; ?? ?else ?? ?{ ?? ??? ?while(getline(txtIn, temp, '\n')) ?? ??? ?{ ?? ??? ??? ?line++; ?? ??? ??? ?if(line == num) ?? ??? ??? ??? ?txtIn >> studentNumber >> password >> name >> sex >> majorAndClass >> birth >> politicStatus >> address; ?? ??? ?} ?? ??? ? ?? ?} ?? ? ?? ?txtIn.close(); }
student.h
#ifndef STUDENT_H #define STUDENT_H #include "user.h" #include <string> using namespace std; class student : public user { public: ?? ?string studentNumber;//學(xué)號,學(xué)生用戶名? ?? ?string majorAndClass;//專業(yè)班級 ?? ?student();//默認(rèn)構(gòu)造函數(shù) ?? ?void setStudentBasicInfo(string studentNumber, string name, string sex, string majorAndClass, string birth, string politicStatus, string address);//設(shè)置學(xué)生基礎(chǔ)信息 ?? ?void searchBasicInfo() const;//查詢基礎(chǔ)信息 ?? ?string getStudentNumber() const;//返回學(xué)號 ?? ?string getName(); ?? ?void writeToTxtFileS() const;//向文件中寫入數(shù)據(jù)? ?? ?void readFromTxtFileS(int);//從文件中讀取數(shù)據(jù)? }; #endif
teacher.cpp
#include "teacher.h" #include ?<fstream> #include ?<iostream> using namespace std; //構(gòu)造函數(shù)? teacher::teacher() { ?? ?user(); //調(diào)用構(gòu)造函數(shù)? ?? ?jobNumber = ""; ? ? college = ""; } //錄入學(xué)生基本信息? void teacher::setTeacherBasicInfo(string jobNumber, string name, string sex, string college, string birth, string politicStatus, string scale) { ?? ?this->name = name; ?? ?this->sex = sex; ?? ?this->birth = birth; ?? ?this->politicStatus = politicStatus; ?? ?this->scale = scale; ?? ?this->jobNumber = jobNumber; ?? ?this->college = college; } //返回教師工號? string teacher::getJobNumber() const { ?? ?return jobNumber; } //查找教師基本信息? void teacher::searchBasicInfo() { ?? ?cout << endl; ?? ?cout << "\t工號:" << jobNumber << " ?姓名:" << name << " ?性別:" << sex << " ?學(xué)院:" << college << " ?生日:" << birth << " ?政治面貌:" << politicStatus << " ?職稱:" << scale << endl; ?? ?cout << endl; } //向文件中寫入數(shù)據(jù)? void teacher::writeToTxtFileT() const { ?? ?ofstream txtOut("teacherBasicInfo.txt", ios::app); ?? ? ?? ?txtOut << jobNumber << " ?" << password << " ?" << name << " ?" << sex << " ?" << college << " ?" << birth << " ?" << politicStatus << " ?" << scale << endl; ?? ? ?? ?txtOut.close(); } //從文件中讀取數(shù)據(jù)? void teacher::readFromTxtFileT(int num) { ?? ?fstream txtIn("teacherBasicInfo.txt", ios::in); ?? ?string temp; ?? ?int line = 1; ?? ?if(num == 1) ?? ??? ?txtIn >> jobNumber >> password >> name >> sex >> college >> birth >> politicStatus >> scale; ?? ?else ?? ?{ ?? ??? ?while(getline(txtIn, temp, '\n')) ?? ??? ?{ ?? ??? ??? ?line++; ?? ??? ??? ?if(line == num) ?? ??? ??? ??? ?txtIn >> jobNumber >> password >> name >> sex >> college >> birth >> politicStatus >> scale; ?? ??? ?} ?? ??? ? ?? ?} ?? ? ? ? txtIn.close(); }
teacher.h
#include"user.h" #include <string> using namespace std; class teacher :public ?user//C++繼承? { protected: ?? ?string jobNumber;//工號 ?? ?string college;//學(xué)院 ?? ?string scale;//職稱? public: ?? ?teacher(); ?? ?string getJobNumber() const; ?? ?void writeToTxtFileT() const;//向文件中寫入數(shù)據(jù)? ?? ?void readFromTxtFileT(int);//從文件中讀取數(shù)據(jù)? ?? ?void setTeacherBasicInfo(string jobNumber, string name, string sex, string college, string birth, string politicStatus, string scale);//設(shè)置教師基礎(chǔ)信息 ?? ?void searchBasicInfo();//查詢基本信息 };
main.cpp
#include <iostream> #include <fstream>//C++文件流? #include <string> #include "user.h" #include "student.h" #include "teacher.h" #include "gradeInfo.h" #include "classInfo.h" #include "systemAdmin.h"? using namespace std; string userName,password,?? ??? ? ? ? ? ?tempCourseNumber,//用于輸入課程編號的地方? ? ? ? ?tempStudentNumber,//用于輸入學(xué)號的地方? ? ? ? ?tempJobNumber;//用于輸入工號的地方? //讀寫刪學(xué)生文件數(shù)據(jù)? ?void writeDataS(student * s, int studentNum); ?void readDataS(student * s, int studentNum); ?void deleteStudentTxtInfo(); // 讀寫刪老師文件數(shù)據(jù) ?void writeDataT(teacher * t, int teachertNum); ?void readDataT(teacher * t, int teacherNum); ?void deleteTeacherTxtInfo(); //寫入文件? ?void writeDataG(gradeInfo * g, int courseNum); ?void readDataG(gradeInfo * g, int courserNum); ?void writeDataA(systemAdmin * a, int systemAdminNum); ?void readDataA(systemAdmin * a, int systemAdminNum); ?void deleteSystemAdminTxtInfo(); ?void writeDataC(classInfo * c, int courseNum); ?void readDataC(classInfo * c, int courseNum); ?void deleteCourseTxtInfo(); //文件寫入?yún)R總信息 //在文件中寫入學(xué)生數(shù)目,課程數(shù)目,老師數(shù)目,系統(tǒng)管理原數(shù)目? ?void writeAllNumToFile(int studentNum, int courseNum, int teacherNum, int systemAdminNum); ?//從文件讀取學(xué)生數(shù)目,課程數(shù)目,老師數(shù)目,系統(tǒng)管理原數(shù)目? ?void readAllNumFromFile(int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum); //展示各登錄 界面? ?void displayLoginForm();//登錄界面展示? ?void studentLoginForm();//學(xué)生功能界面展示? ?void teacherLoginForm();//教師功能界面展示? ?void systemAdminLoginForm();//管理員功能界面展示? ?void studentBasicInfoManageForm();//學(xué)生信息管理界面展示? ?void teacherBasicInfoManageForm();//老師信息管理界面展示? ?void classBasicInfoManageForm(); //信息管理界面展示? ?void studentGradeSearchForm();//學(xué)生成績界面 ?void studentBasicInfoSearchForm();//學(xué)生成績查詢界面 ?void teacherBasicInfoSearchForm();//教師信息查詢界面 ?void classBasicInfoSearchForm();//課程信息查詢界面 //返回界面? ?void enter0ToBack(int& num);? //按照課程信息查找成績? ?void studentSearchGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3); //按照課程編號和學(xué)生學(xué)號查詢學(xué)生信息? ?void teacherSearchSingleGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3, int& flag5); ?//查詢所有課程? ?void teacherSearchAllGrade(classInfo * c, gradeInfo * g, student * s, int courseNum, int studentNum, int& flag3); ?void teacherIuputGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3); ?void systemAdminInputSBasicInfo(student * s, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i); ?void systemAdminSearchSingleSBasicInfo(student * s, int studentNum, int& flag7);?? ? ?void systemAdminSearchAllSBasicInfo(student * s, int studentNum); ?void systemAdminDeleteSBasicInfo(systemAdmin * a, student * s, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i); ?void systemAdminInputTBasicInfo(teacher * t, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i); ?void systemAdminSearchSingleTBasicInfo(teacher * t, int teacherNum, int& flag7);?? ? ?void systemAdminSearchAllTBasicInfo(teacher * t, int teacherNum); ?void systemAdminDeleteTBasicInfo(systemAdmin * a, teacher * t, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i); //錄入學(xué)生信息? ?void systemAdminInputCBasicInfo(classInfo * c, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i); ?//查詢學(xué)生信息? ?void systemAdminSearchSingleCBasicInfo(classInfo * c, int courseNum, int& flag7); //展示錄入的學(xué)生信息? ?void systemAdminSearchAllCBasicInfo(classInfo * c, int courseNum); ?//刪除管理基本信息? ?void systemAdminDeleteCBasicInfo(systemAdmin * a, classInfo * c, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i); //學(xué)生選課信息? ?void generateSSelectionInfo(classInfo * c, gradeInfo * f, student * s, int courseNum, int studentNum); //判斷老師是否帶這門課? ?bool isTeacherClass(classInfo * c, string courseNumber, string userName, int courseNum); ?//判斷學(xué)生是否在這門課中 ?bool isInThisCourse(gradeInfo * g, string courseNumber, string studentNumber, int courseNum); int main() { ?? ?int flag[10]= {0}, ? ? ? ? studentNum = 5, ?? ? ? ?courseNum = 3, ?? ? ? ?teacherNum = 2, ?? ? ? ?systemAdminNum = 1;?? ? ?? ??? ? ?? ?//writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum); ?? ?readAllNumFromFile(studentNum, courseNum, teacherNum, systemAdminNum);?? ? ?? ?student * s = new student[studentNum + 200]; ?? ?teacher * t = new teacher[teacherNum + 200]; ?? ?gradeInfo * g = new gradeInfo[courseNum + 200]; ?? ?systemAdmin * a = new systemAdmin[systemAdminNum + 200]; ?? ?classInfo * c = new classInfo[courseNum + 200];?? ??? ? ? ?? ?while (flag[0] == 0)//flag[0]用于返回登陸界面? ?? ?{ ?? ??? ?readDataG(g, courseNum); ? ? ? ? readDataT(t, teacherNum); ? ? ? ? readDataS(s, studentNum); ? ? ? ? readDataA(a, systemAdminNum); ? ? ? ? readDataC(c, courseNum); ?? ??? ?displayLoginForm();?? ??? ? ?? ??? ?for (int i = 0; i < 10; i++) ?? ??? ? ? ? flag[i] = 0;?? ??? ?//重新開始登陸,標(biāo)記值需要返0,否則會產(chǎn)生錯誤? ?? ??? ?for (int i = 0; i < studentNum; i++) ?? ??? ?{ ?? ??? ??? ?if (userName == s[i].getStudentNumber() && password == s[i].getPassword()) ?? ??? ??? ?{ ?? ??? ??? ??? ?while(flag[1] == 0)//flag[1]用于返回功能管理界面? ?? ??? ??? ??? ?{ ?? ??? ??? ??? ??? ?flag[3] = 0;//判定學(xué)生輸入的課程編碼是否是他的上課編碼? ?? ??? ??? ??? ??? ?studentLoginForm(); ?? ??? ??? ??? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ?switch (flag[0]) ?? ??? ??? ? ? ? ?? ?{ ?? ??? ??? ? ? ? ? ??? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ?? ?s[i].searchBasicInfo(); ?? ??? ??? ??? ? ? ? ? ? ?? ?enter0ToBack(flag[1]); ?? ??? ??? ??? ??? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ?? ??? ??? ??? ? ? ? ? ?case 2: ?? ??? ??? ??? ? ? ? ? ??? ?studentSearchGrade(c, g, courseNum, flag[3]);?? ??? ??? ??? ??? ? ? ? ? ?? ? ?? ??? ??? ??? ??? ? ? ? ? ?? ?enter0ToBack(flag[1]); ?? ??? ??? ??? ??? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ?? ??? ??? ? ? ? ? ? ?? ?case 3: ?? ??? ??? ??? ? ? ? ? ? ?? ?s[i].changePassword();? ?? ??? ??? ??? ? ? ? ? ? ?? ?deleteStudentTxtInfo();? ? ? ? ? ? ? ? ? ? ? ? ? ?? ?writeDataS(s, studentNum); ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ? ??? ? ? ? ? ?case 4: ?? ??? ??? ??? ? ? ? ? ? ? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ??? ??? ??? ??? ?? ?? ??? ??? ??? ? ? ? ? ?case 5: ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 1;flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ??? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字?。?!" << endl;? ?? ??? ??? ??? ? ? ? ?} ?? ??? ??? ? ? ?}? ?? ? ? ??? ?} ?? ??? ??? ? ?? ?? ??? ??? ?else ?? ??? ??? ? ? ?continue; ?? ??? ??? ? ? ? ?? ?? ??? ??? ?flag[2]++;//flag[2]用于檢測密碼正誤 ,若一直為0,則說明未進(jìn)入 功能界面,也就是無任何匹配的賬號? ? ? ?? ?} ?? ??? ?for (int i = 0; i < teacherNum; i++) ?? ??? ?{ ?? ??? ??? ?if (userName == t[i].getJobNumber() && password == t[i].getPassword()) ?? ??? ??? ?{ ?? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ?while(flag[1] == 0)//flag[1]用于返回功能管理界面? ?? ??? ??? ??? ?{ ?? ??? ??? ??? ??? ?flag[3] = 0;//判定教師輸入的課程編碼是否是他的教學(xué)課程? ?? ??? ??? ??? ??? ?flag[5] = 0;//判定學(xué)生輸入的課程編碼是否是他的上課編碼? ?? ??? ??? ??? ??? ?flag[4] = 0; ?? ??? ??? ??? ??? ?teacherLoginForm(); ?? ??? ??? ??? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ? ?? ??? ??? ??? ? ? ?switch (flag[0]) ?? ??? ??? ? ? ? ?? ?{ ?? ??? ??? ? ? ? ? ??? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ?? ?t[i].searchBasicInfo(); ?? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[1]); ?? ??? ??? ??? ??? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ?? ??? ??? ??? ? ? ? ? ?case 2: ?? ??? ??? ??? ? ? ? ? ??? ?while(flag[4] == 0)//用于第三層小循環(huán)? ?? ??? ??? ??? ? ? ? ? ??? ?{ ?? ??? ??? ??? ? ? ? ? ??? ? ? ?studentGradeSearchForm();?? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?cin >> flag[4]; ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?switch(flag[4]) ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?{? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ??? ?teacherSearchSingleGrade(c, g, courseNum, flag[3], flag[5]); ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ?? ??? ? case 2: //輸出全體學(xué)生成績 ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?teacherSearchAllGrade(c, g, s, courseNum, studentNum, flag[3]); ?? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ??? ?case 3://返回教師功能界面 ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?? ? ?? ?flag[4] = 1; flag[1] = 0;?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ??? ?case 4: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 1; flag[0] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ?case 5://退出程序? ?? ??? ??? ??? ??? ??? ??? ??? ? ? ??? ?flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ??? ??? ??? ? ? ?? ? ?? ?break;? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ?default: ?? ??? ??? ??? ??? ? ? ? ? ? ? ??? ??? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字?。?!" << endl;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ?} ?? ??? ??? ??? ??? ? ? ? ? ?} ?? ??? ??? ??? ??? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ?case 3: ?? ??? ??? ??? ??? ? ? ??? ?teacherIuputGrade(c, g, courseNum, flag[3]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?? ?? ??? ??? ??? ??? ? ? ??? ?enter0ToBack(flag[1]); ?? ??? ??? ??? ??? ? ? ??? ?break; ?? ??? ??? ??? ? ?? ??? ??? ? ? ? ? ? ?? ?case 4: ?? ??? ??? ??? ? ? ? ? ? ?? ?t[i].changePassword();? ?? ? ? ? ? ? ? ? ? ? ? ? ? ?deleteTeacherTxtInfo(); ? ? ? ? ? ? ? ? ? ? ? ? ?? ?writeDataT(t, teacherNum);?? ??? ??? ??? ? ? ? ? ? ?? ? ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ? ??? ? ? ? ? ?case 5: ?? ??? ??? ??? ? ? ? ? ? ? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ??? ??? ??? ??? ?? ?? ??? ??? ??? ? ? ? ? ?case 6: ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 1; flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ??? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字??!" << endl;? ?? ??? ??? ??? ? ? ? ?} ?? ??? ??? ? ? ?}? ?? ? ? ??? ?} ? ? ? ? ? ?? ?? ? ? ? ? ?else ?? ??? ??? ? ? ? ? continue; ?? ??? ??? ?flag[2]++;//flag[2]用于檢測密碼正誤 ,若一直為0,則說明未進(jìn)入 功能界面,也就是無任何匹配的賬號? ? ? ?? ?}?? ? ?? ??? ?for (int i = 0; i < systemAdminNum; i++) ?? ??? ?{ ?? ??? ??? ?if (userName == a[i].getUserName() && password == a[i].getPassword()) ?? ??? ??? ?{ ?? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ?while(flag[1] == 0)//flag[1]用于返回功能管理界面? ?? ??? ??? ??? ?{?? ? ?? ??? ??? ??? ??? ?flag[4] = 0;?? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?flag[7] = 0; ?? ??? ??? ??? ??? ?systemAdminLoginForm(); ?? ??? ??? ??? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ?switch (flag[0]) ?? ??? ??? ? ? ? ?? ?{ ?? ??? ??? ? ? ? ? ??? ?case 1: ?? ??? ??? ??? ? ? ? ? ??? ?while(flag[4] == 0)//用于第三層小循環(huán)? ?? ??? ??? ??? ? ? ? ? ??? ?{ ?? ??? ??? ??? ??? ??? ??? ??? ?flag[7] = 0;?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flag[6] = 0; ?? ??? ??? ??? ? ? ? ? ??? ? ? ?studentBasicInfoManageForm();?? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?switch(flag[0]) ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?{? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ??? ?systemAdminInputSBasicInfo(s, a, studentNum, courseNum, teacherNum, systemAdminNum, i);?? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 2: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?while(flag[6] == 0) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?flag[7] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?studentBasicInfoSearchForm(); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?cin >> flag[0]; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?switch(flag[0]) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ?case 1:?? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ?systemAdminSearchSingleSBasicInfo(s, studentNum, flag[7]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ?enter0ToBack(flag[6]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;?? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 2: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?systemAdminSearchAllSBasicInfo(s, studentNum); ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[6]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 3: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 4: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 5: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字?。?!" << endl; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 3:? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?systemAdminDeleteSBasicInfo(a, s, studentNum, courseNum, teacherNum, systemAdminNum, flag[7], i); ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ? ? ??? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 4: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 5: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;?? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ? cout << "數(shù)據(jù)錯誤,請重新輸入?。?!" << endl;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ?} ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? } ?? ??? ??? ??? ??? ? ? ? ? ?break; ? ? ? ? ? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ? ? ? ? ?case 2: ?? ??? ??? ??? ? ? ? ? ??? ?while(flag[4] == 0)//用于第三層小循環(huán)? ?? ??? ??? ??? ? ? ? ? ??? ?{ ?? ??? ??? ??? ??? ??? ??? ??? ?flag[7] = 0;?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flag[6] = 0;?? ??? ??? ??? ? ? ? ? ??? ??? ? ?? ??? ??? ??? ? ? ? ? ??? ? ? ?teacherBasicInfoManageForm();?? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?switch(flag[0]) ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?{? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ??? ?systemAdminInputTBasicInfo(t, a, studentNum, courseNum, teacherNum, systemAdminNum, i); ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 2: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?while(flag[6] == 0) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?flag[7] = 0;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?teacherBasicInfoSearchForm(); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?cin >> flag[0]; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?switch(flag[0]) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ?case 1: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ?systemAdminSearchSingleTBasicInfo(t, teacherNum, flag[7]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[6]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;?? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 2: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? systemAdminSearchAllTBasicInfo(t, teacherNum); ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?enter0ToBack(flag[6]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 3: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 4: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 5: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字?。?!" << endl; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;?? ??? ??? ??? ??? ? ? ? ? ? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 3:? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?systemAdminDeleteTBasicInfo(a, t, studentNum, courseNum, teacherNum, systemAdminNum, flag[7], i);?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break;?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 4: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 5: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ?cout << "數(shù)據(jù)錯誤,請重新輸入?。?!" << endl;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ?} ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? } ?? ??? ??? ??? ??? ? ? ? ? ?break; ? ? ? ? ? ??? ??? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ?case 3: ?? ??? ??? ??? ? ? ? ? ??? ?while(flag[4] == 0)//用于第三層小循環(huán)? ?? ??? ??? ??? ? ? ? ? ??? ?{ ?? ??? ??? ??? ? ? ? ? ??? ??? ?flag[7] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 0;? ?? ??? ??? ??? ? ? ? ? ??? ? ? ?classBasicInfoManageForm();?? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?cin >> flag[0]; ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?switch(flag[0]) ?? ??? ??? ??? ? ? ? ? ? ? ? ? ?{? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?case 1: ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ??? ?systemAdminInputCBasicInfo(c, a, studentNum, courseNum, teacherNum, systemAdminNum, i);?? ??? ? ?? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 2: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?while(flag[6] == 0) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?flag[7] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?classBasicInfoSearchForm(); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?cin >> flag[0]; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?switch(flag[0]) ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?{ ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ?case 1: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ?systemAdminSearchSingleCBasicInfo(c, courseNum, flag[7]);?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[6]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;?? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 2: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?systemAdminSearchAllCBasicInfo(c, courseNum);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?enter0ToBack(flag[6]);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 3: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 4: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 0; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?case 5: ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?flag[6] = 1; flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ? ? ? ? ? ? ?cout << "數(shù)據(jù)錯誤,請重新輸入數(shù)字?。。? << endl; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?} ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 3:? ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?systemAdminDeleteCBasicInfo(a, c, studentNum, courseNum, teacherNum, systemAdminNum, flag[7], i);?? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ?enter0ToBack(flag[4]); ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 4: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 0; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?case 5: ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?flag[4] = 1; flag[1] = 1; flag[0] = 1; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ??? ?break; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ? ? ? ? ? ? ? cout << "數(shù)據(jù)錯誤,請重新輸入?。?!" << endl;? ?? ??? ??? ??? ??? ? ? ? ? ? ? ?} ? ? ? ? ?? ??? ??? ??? ??? ? ? ? ? } ?? ??? ??? ??? ??? ? ? ? ? ?break; ? ? ? ? ? ? ?? ??? ??? ??? ??? ? ? ?case 4: ?? ??? ??? ??? ??? ? ? ??? ?generateSSelectionInfo(c, g, s, courseNum, studentNum);?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ?? ?? ??? ??? ??? ??? ? ? ??? ?enter0ToBack(flag[1]); ?? ??? ??? ??? ??? ? ? ??? ?break; ?? ??? ??? ? ? ? ? ? ?? ?case 5: ?? ??? ??? ??? ? ? ? ? ? ?? ?a[i].changePassword();? ?? ??? ??? ??? ? ? ? ? ? ?? ?deleteSystemAdminTxtInfo(); ?? ? ? ? ? ? ? ? ? ? ? ? ? ?writeDataA(a, systemAdminNum); ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ? ??? ? ? ? ? ?case 6: ?? ??? ??? ??? ? ? ? ? ? ? ?flag[0] = 0;flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ?case 7: ?? ??? ??? ??? ? ? ? ? ??? ?flag[0] = 1; flag[1] = 1;break; ?? ??? ??? ??? ? ? ? ? ?default: ?? ??? ??? ??? ? ? ? ? ??? ?cout << "數(shù)據(jù)錯誤,請重新輸入?。?!" << endl;? ?? ??? ??? ??? ? ? ? ?} ?? ??? ??? ? ? ?}? ?? ? ? ??? ?} ?? ??? ??? ?else ?? ??? ??? ? ? ? ? continue; ?? ??? ??? ?flag[2]++;//flag[2]用于檢測密碼正誤 ,若一直為0,則說明未進(jìn)入 功能界面,也就是無任何匹配的賬號? ?? ??? ?} ? ? ? ? if (flag[2] == 0)//flag[2]用于檢測密碼正誤? ? ? ? ? ? ? cout << "用戶名和密碼輸入錯誤,請重新登錄!" << endl; ?? ?} ?? ?system("pause"); ?? ?return 0; } //登錄界面展示? ?void displayLoginForm() { ?? ?cout << endl; ?? ?system("color 2f"); ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ?教務(wù)管理系統(tǒng)登陸界面\t\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t用戶名:"; ?? ?cin >> userName; ?? ?cout << "\t\t\t\t\t\t密碼 ?:"; ?? ?cin >> password; } //教師功能界面展示? ?void teacherLoginForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到教師功能界面\t\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢基本信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢成績信息" << endl; ?? ?cout << "\t\t\t\t\t\t3.錄入學(xué)生成績" << endl; ?? ?cout << "\t\t\t\t\t\t4.修改密碼" << endl; ?? ?cout << "\t\t\t\t\t\t5.返回登陸界面" << endl; ?? ?cout << "\t\t\t\t\t\t6.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: " ; } //管理員功能界面展示? ?void systemAdminLoginForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到管理員功能界面\t\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.管理學(xué)生基本信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.管理教師基本信息" << endl; ?? ?cout << "\t\t\t\t\t\t3.管理課程信息" << endl; ?? ?cout << "\t\t\t\t\t\t4.生成學(xué)生選課信息" << endl; ?? ?cout << "\t\t\t\t\t\t5.修改密碼" << endl; ? ? cout << "\t\t\t\t\t\t6.返回登陸界面" << endl; ? ? cout << "\t\t\t\t\t\t7.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: ";? } //學(xué)生功能界面展示? ?void studentLoginForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到學(xué)生功能界面\t\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢基本信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢成績信息" << endl; ?? ?cout << "\t\t\t\t\t\t3.修改密碼" << endl; ?? ?cout << "\t\t\t\t\t\t4.返回登陸界面" << endl; ?? ?cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: " ; } //學(xué)生信息管理界面展示? ?void studentBasicInfoManageForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ?歡迎來到學(xué)生信息管理界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.錄入學(xué)生信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢學(xué)生信息" << endl; ?? ?cout << "\t\t\t\t\t\t3.刪除學(xué)生信息" << endl; ?? ?cout << "\t\t\t\t\t\t4.返回管理員功能界面" << endl; ?? ?cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: " ; } // 教師信息管理界面 ?void teacherBasicInfoManageForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ?歡迎來到教師信息管理界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.錄入教師信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢師信息查詢" << endl; ?? ?cout << "\t\t\t\t\t\t3.教師信息刪除" << endl; ?? ?cout << "\t\t\t\t\t\t4.返回管理員功能界面" << endl; ?? ?cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: " ; } //程信息管理界面 ?void classBasicInfoManageForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ?歡迎來到課程信息管理界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.錄入課程信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢課程信息" << endl; ?? ?cout << "\t\t\t\t\t\t3.刪除課程信息" << endl; ? ? cout << "\t\t\t\t\t\t4.返回管理員功能界面" << endl; ? ? cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: ";? } //學(xué)生成績查詢界面 ?void studentGradeSearchForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 學(xué)生成績查詢界面\t\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢單個學(xué)生成績" << endl; ?? ?cout << "\t\t\t\t\t\t2.查詢?nèi)w學(xué)生成績" << endl; ? ? cout << "\t\t\t\t\t\t3.返回教師功能界面" << endl; ? ? cout << "\t\t\t\t\t\t4.返回登陸界面" << endl; ? ? ? ? cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: "; ?? ? } //學(xué)生成績查詢界面 ?void studentBasicInfoSearchForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到學(xué)生信息查詢界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢單個學(xué)生信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.生成全體學(xué)生信息" << endl; ? ? cout << "\t\t\t\t\t\t3.返回學(xué)生信息管理界面" << endl; ? ? cout << "\t\t\t\t\t\t4.返回登陸界面" << endl; ? ? ? ? cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: "; ?? ??? ? } //教師信息查詢界面 ?void teacherBasicInfoSearchForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到教師信息查詢界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢單個教師信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.生成全體教師信息" << endl; ? ? cout << "\t\t\t\t\t\t3.返回教師信息管理界面" << endl; ? ? cout << "\t\t\t\t\t\t4.返回登陸界面" << endl; ? ? ? ? cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: "; ?? ??? ? } //課程信息查詢界面 ?void classBasicInfoSearchForm() { ?? ?cout << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "*\t\t\t\t\t ? ? ? ? 歡迎來到課程信息查詢界面\t\t\t\t\t ? ? ? *" << endl; ?? ?cout << "************************************************************************************************************************" << endl; ?? ?cout << "\t\t\t\t\t\t1.查詢單個課程信息" << endl; ?? ?cout << "\t\t\t\t\t\t2.生成全體課程信息" << endl; ? ? cout << "\t\t\t\t\t\t3.返回課程信息管理界面" << endl; ? ? cout << "\t\t\t\t\t\t4.返回登陸界面" << endl; ? ? ? ? cout << "\t\t\t\t\t\t5.退出" << endl; ?? ?cout << "輸入對應(yīng)的數(shù)字進(jìn)行相關(guān)操作: "; ?? ??? ? } //學(xué)生信息保存到文件中? ?void writeDataS(student * s, int studentNum) { ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?s[i].writeToTxtFileS(); ?? ?}?? ? } //讀取學(xué)生信息? ?void ?readDataS(student * s, int studentNum) { ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?s[i].readFromTxtFileS(i + 1); ?? ?} } //刪除學(xué)生信息? ?void deleteStudentTxtInfo() { ?? ?ofstream output("studentBasicInfo.txt"); ?? ?output.close();?? ? } //輸入老師信息? ?void writeDataT(teacher * t, int teacherNum) { ?? ?for (int i = 0; i < teacherNum; i++) ?? ?{ ?? ??? ?t[i].writeToTxtFileT(); ?? ?} } //讀取老師信息? ?void ?readDataT(teacher * t, int teacherNum) { ?? ?for (int i = 0; i < teacherNum; i++) ?? ?{ ?? ??? ?t[i].readFromTxtFileT(i + 1); ?? ?} } //刪除老師信息? ?void deleteTeacherTxtInfo() { ?? ?ofstream output("teacherBasicInfo.txt"); ?? ?output.close();?? ? } //寫入管理信息? ?void writeDataG(gradeInfo * g, int courseNum) { ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?g[i].writeToTxtFileG(i); ?? ?} } //讀取管理信息? ?void ?readDataG(gradeInfo * g, int courseNum) { ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?g[i].readFromTxtFileG(i); ?? ?} } //文件寫入管理密碼? ?void writeDataA(systemAdmin * a, int systemAdminNum) { ?? ?for (int i = 0; i < systemAdminNum; i++) ?? ?{ ?? ??? ?a[i].writeToTxtFileA(); ?? ?} } //讀取管理密碼信息? ?void readDataA(systemAdmin * a, int systemAdminNum) { ?? ?for (int i = 0; i < systemAdminNum; i++) ?? ?{ ?? ??? ?a[i].readFromTxtFileA(i + 1); ?? ?}?? ? } //管理員密碼文件? ?void deleteSystemAdminTxtInfo() { ?? ?ofstream output("systemAdminBasicInfo.txt"); ?? ?output.close();?? ??? ? } //寫入課程信息? ?void writeDataC(classInfo * c, int courseNum) { ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?c[i].writeToTxtFileC(); ?? ?} } //讀取課程信息? ?void readDataC(classInfo * c, int courseNum) { ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?c[i].readFromTxtFileC(i + 1); ?? ?}?? ? } //刪除課程信息? ?void deleteCourseTxtInfo() { ?? ?ofstream output("classBasicInfo.txt"); ?? ?output.close();?? ??? ??? ? } //在文件中寫入學(xué)生數(shù)目,課程數(shù)目,老師數(shù)目,系統(tǒng)管理原數(shù)目? ?void writeAllNumToFile(int studentNum, int courseNum, int teacherNum, int systemAdminNum) { ?? ?ofstream output("allNum.txt"); ?? ?output << studentNum << " ?" << courseNum << " ?" << teacherNum << " ?" << systemAdminNum << endl; ?? ?output.close();? } //從文件讀取學(xué)生數(shù)目,課程數(shù)目,老師數(shù)目,系統(tǒng)管理原數(shù)目? ?void readAllNumFromFile(int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum) { ?? ?ifstream input("allNum.txt"); ?? ?input >> studentNum >> courseNum >> teacherNum >> systemAdminNum; ?? ?input.close();? } //返回上虞界面;? ?void enter0ToBack(int& num)? { ? ? cout << "按0鍵返回上一層: "; ?? ?cin >> num; ?? ?while(num != 0) ?? ?{ ?? ? ? ?cout << "指令無效,請輸入0返回上一層: "; ?? ??? ?cin >> num; ?? ?} } //按照課程信息查找成績? ?void studentSearchGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3) { ?? ?cout << endl << "請輸入課程編號來查詢相應(yīng)課程成績: "; ?? ?cin >> tempCourseNumber ; ?? ??? ??? ??? ??? ? ?? ?for (int j = 0; j < courseNum; j++)//多層循環(huán)不可通用一個變量? ?? ?{ ?? ??? ?if (tempCourseNumber == g[j].getCourseNumber() && isInThisCourse(g, tempCourseNumber, userName, courseNum)) ?? ??? ?{ ?? ??? ??? ?cout << endl << "\t\t課程編號:" << tempCourseNumber << " ?課程名稱:" << c[j].getCourseName() << " ?課程學(xué)分:" << c[j].getCredit(); ?? ??? ??? ?g[j].searchSingleGrade(userName); ?? ??? ??? ?flag3++; ?? ??? ?} ?? ?}?? ??? ??? ??? ? ?? ?if (flag3 == 0) ?? ??? ?cout << "課程編號輸入錯誤,您無此課程?。?!" << endl;? } //按照課程編號和學(xué)生學(xué)號查詢學(xué)生信息? ?void teacherSearchSingleGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3, int& flag5) { ?? ?cout << endl; ?? ?cout << "請輸入您要查詢的課程的課程編號: "; ?? ?cin >> tempCourseNumber;?? ??? ??? ??? ??? ??? ? ?? ?for (int j = 0; j < courseNum; j++) ?? ?{?? ??? ?? ?? ??? ?if (tempCourseNumber == c[j].getCourseNumber() && userName == c[j].getJobNumberOfTeacher()) ?? ??? ?{ ?? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cout << "請輸入您要查詢學(xué)生的學(xué)號 ? ? ?: "; ?? ??? ??? ?cin >> tempStudentNumber;? ?? ??? ??? ??? ??? ? ? ??? ? ? ??? ? ? ?? ?? ??? ??? ?if (isInThisCourse(g, tempCourseNumber, tempStudentNumber, courseNum))? ?? ??? ??? ?{ ?? ??? ??? ??? ?cout << endl;? ? ? ? ? ? ? ? ? cout << "\t\t課程編號:" << tempCourseNumber << " ?課程名稱:" << c[j].getCourseName() << " ?課程學(xué)分:" << c[j].getCredit(); ?? ??? ??? ??? ?g[j].searchSingleGrade(tempStudentNumber); ?? ??? ??? ??? ?flag5++; ?? ??? ??? ?} ? ?? ? ?? ??? ??? ??? ?flag3++; ?? ??? ?} ?? ?}?? ??? ??? ??? ? ? ??? ? ?? ?if (flag3 == 0) ?? ??? ?cout << "輸入課程編碼錯誤,您沒有這堂課,請重新進(jìn)行操作!" ?<< endl;?? ??? ??? ? ? ??? ? ? ? ? ? ?? ?if (flag3 != 0 && flag5 == 0) ?? ??? ?cout << "您沒有學(xué)生是這個學(xué)號,請重新操作?。?!" << endl; ??? ? } //查詢所有課程? ?void teacherSearchAllGrade(classInfo * c, gradeInfo * g, student * s, int courseNum, int studentNum, int& flag3)? { ?? ?cout << endl; ?? ?cout << "請輸入您要查詢的課程的課程編碼: "; ?? ?cin >> tempCourseNumber; ?? ?cout << endl; ?? ?for (int j = 0; j < courseNum; j++) ?? ?{?? ??? ?? ?? ??? ?if (tempCourseNumber == c[j].getCourseNumber() && userName == c[j].getJobNumberOfTeacher()) ?? ??? ?{?? ??? ??? ??? ? ? ??? ? ? ??? ? ? ? ? ? ? ? ?? ??? ??? ?cout << "課程編號: " << tempCourseNumber << " ?課程名稱: " << c[j].getCourseName() << " ?課程學(xué)分: " << c[j].getCredit() << endl; ? ? ? ? ? ? g[j].searchAllGrade(s, studentNum); ?? ??? ??? ??? ??? ? ? ??? ? ? ??? ? ?? ??? ??? ?flag3++; ?? ??? ?} ?? ?}?? ??? ??? ??? ? ? ??? ? ?? ?if (flag3 == 0) ?? ? ? ?cout << "輸入課程編碼錯誤,您沒有這堂課,請重新進(jìn)行操作!" ?<< endl;?? ? } //輸入課程? ?void teacherIuputGrade(classInfo * c, gradeInfo * g, int courseNum, int& flag3) { ?? ?cout << endl; ? ? cout << "請輸入課程編號 ? ?: "; ?? ?cin >> tempCourseNumber;? ?? ?cout << endl;?? ??? ? ? ??? ? ?? ?for (int j = 0; j < courseNum; j++) ?? ?{?? ??? ??? ??? ??? ??? ? ? ? ? ? ?? ?? ?? ??? ?if (tempCourseNumber == c[j].getCourseNumber() && userName == c[j].getJobNumberOfTeacher()) ?? ? ? ?{ ?? ??? ? ? ?g[j].setGrade(); ? ? ? ? ? ? writeDataG(g, courseNum); ?? ??? ??? ?flag3++; ?? ??? ?} ?? ?} ?? ??? ??? ??? ??? ? ? ??? ? ?? ?if (flag3 == 0) ?? ??? ?cout << "輸入課程編碼錯誤,您沒有這堂課,請重新進(jìn)行操作!" ?<< endl; } //錄入學(xué)生信息? ?void systemAdminInputSBasicInfo(student * s, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i) { ?? ?cout << "請開始錄入學(xué)生信息: " << endl;? ?? ?a[i].inputStudentBasicInfo(s, studentNum); ?? ?deleteStudentTxtInfo();? ?? ?writeDataS(s, studentNum); ?? ?writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum);?? ? } //查詢學(xué)生信息? ?void systemAdminSearchSingleSBasicInfo(student * s, int studentNum, int& flag7) { ?? ?cout << "請輸入您要查詢基本信息的學(xué)生的學(xué)號: "; ?? ?cin >> tempStudentNumber;? ?? ?for (int j = 0; j < studentNum; j++)? ?? ?if (tempStudentNumber == s[j].getStudentNumber()) ?? ?{ ?? ? ? ?s[j].searchBasicInfo(); ?? ??? ?flag7 ++; ?? ?} ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ?? ?if (flag7 == 0) ?? ? ? ?cout << "抱歉,您輸入的學(xué)號不存在,請仔細(xì)校對后再重新查詢!" << endl; } ?void systemAdminSearchAllSBasicInfo(student * s, int studentNum) { ?? ?cout << "如下是所有學(xué)生的基本信息: " << endl; ?? ?for (int i = 0; i < studentNum; i++) ?? ?{ ?? ??? ?s[i].searchBasicInfo(); ?? ?} ?? ?cout << endl; ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? } //刪除學(xué)生的信息? ?void systemAdminDeleteSBasicInfo(systemAdmin * a, student * s, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i) { ?? ?cout << "請輸入要刪除信息的學(xué)生的學(xué)號: "; ?? ?cin >> tempStudentNumber; ?? ?for (int j = 0; j < studentNum; j++) ?? ?{ ?? ??? ?if (tempStudentNumber == s[j].getStudentNumber()) ?? ??? ?{ ?? ??? ??? ?a[i].deleteStudentBasicInfo(s, tempStudentNumber, studentNum); ? ? ? ? ? ? deleteStudentTxtInfo();? ?? ? ? ? ? ?writeDataS(s, studentNum); ?? ? ? ? ? ?writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum); ?? ??? ??? ?cout << "學(xué)生信息刪除成功?。?!" << endl;? ?? ??? ??? ?flag7++; ?? ??? ?} ?? ?}?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ?if (flag7 == 0) ?? ??? ?cout << "您輸入的學(xué)號不存在,請重新操作!?。? << endl; ?? ??? ? } //錄入教師信息 ?void systemAdminInputTBasicInfo(teacher * t, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i) { ?? ?cout << "請開始錄入教師信息: " << endl;? ?? ?a[i].inputTeacherBasicInfo(t, teacherNum); ?? ?deleteTeacherTxtInfo();? ?? ?writeDataT(t, teacherNum); ?? ?writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum);?? ??? ??? ??? ??? ??? ??? ? ? ? ? ??? ? } // 查詢教師基本信息 ?void systemAdminSearchSingleTBasicInfo(teacher * t, int teacherNum, int& flag7) { ?? ?cout << "請輸入您要查詢基本信息的教師工號: "; ?? ?cin >> tempJobNumber;? ?? ?for (int j = 0; j < teacherNum; j++)? ?? ?if (tempJobNumber == t[j].getJobNumber()) ?? ?{ ?? ??? ?t[j].searchBasicInfo(); ?? ??? ?flag7 ++; ?? ?} ?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ?? ?if (flag7 == 0) ?? ??? ?cout << "抱歉,您輸入的工號不存在,請仔細(xì)校對后再重新查詢!" << endl;?? ? } //展示所有教師的基本信息? ?void systemAdminSearchAllTBasicInfo(teacher * t, int teacherNum) { ?? ?cout << "如下是所有教師的基本信息: " << endl; ?? ?for (int i = 0; i < teacherNum; i++) ?? ?{ ?? ? ? ?t[i].searchBasicInfo(); ?? ?}?? ? } //刪除某教師的基本信息? ?void systemAdminDeleteTBasicInfo(systemAdmin * a, teacher * t, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i) { ?? ?cout << "請輸入要刪除信息的教師的工號: "; ?? ?cin >> tempJobNumber; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ?for (int j = 0; j < teacherNum; j++) ?? ?{ ?? ??? ?if (tempJobNumber == t[j].getJobNumber()) ?? ??? ?{ ? ? ? ? ? ? a[i].deleteTeacherBasicInfo(t, tempJobNumber, teacherNum); ? ? ? ? ? ? deleteTeacherTxtInfo();? ?? ? ? ? ? ?writeDataT(t, teacherNum); ?? ? ? ? ? ?writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum); ?? ??? ??? ?cout << "刪除成功!??!" << endl;? ?? ??? ??? ?flag7++; ?? ??? ?} ?? ?}?? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ?if (flag7 == 0) ?? ??? ?cout << "您輸入的教師工號不存在,請重新操作?。?!" << endl; ?? ? } //錄入課程信息? ?void systemAdminInputCBasicInfo(classInfo * c, systemAdmin * a, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int i) { ?? ?cout << "請開始錄入課程信息: " << endl;? ?? ?a[i].inputClassBasicInfo(c, courseNum); ?? ?deleteCourseTxtInfo();? ?? ?writeDataC(c, courseNum); ?? ?writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum);?? ? } //查詢課程基本信息? ?void systemAdminSearchSingleCBasicInfo(classInfo * c, int courseNum, int& flag7) { ?? ?cout << "請輸入您要查詢基本信息的課程的課程編號: "; ?? ?cin >> tempCourseNumber;? ?? ?for (int j = 0; j < courseNum; j++)? ?? ?if (tempCourseNumber == c[j].getCourseNumber()) ?? ?{ ?? ??? ?c[j].searchBasicInfo(); ?? ??? ?flag7 ++; ?? ?}?? ??? ??? ??? ??? ??? ??? ??? ??? ??? ? ? ? ?? ?if (flag7 == 0) ?? ??? ?cout << "抱歉,您輸入的課程編號不存在,請仔細(xì)校對后再重新查詢!" << endl; } //展示所有課程的基本信息? ?void systemAdminSearchAllCBasicInfo(classInfo * c, int courseNum) { ?? ?cout << "如下是所有課程的基本信息: " << endl; ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?c[i].searchBasicInfo(); ?? ?} ?? ? ?? ?cout << endl; } //刪除某課程信息? ?void systemAdminDeleteCBasicInfo(systemAdmin * a, classInfo * c, int& studentNum, int& courseNum, int& teacherNum, int& systemAdminNum, int& flag7, int i) { ?? ?cout << "請輸入要刪除信息的課程的課程編號: "; ?? ?cin >> tempCourseNumber; ?? ??? ??? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ?for (int j = 0; j < courseNum; j++) ?? ?{ ?? ??? ?if (tempCourseNumber == c[j].getCourseNumber()) ?? ??? ?{ ? ? ? ? ? ?a[i].deleteClassBasicInfo(c, tempCourseNumber, courseNum); ? ? ? ? ? ?deleteCourseTxtInfo();? ?? ? ? ? ? writeDataC(c, courseNum); ?? ? ? ? ? writeAllNumToFile(studentNum, courseNum, teacherNum, systemAdminNum); ?? ??? ? ? cout << "課程信息刪除成功!??!" << endl;? ?? ??? ? ? flag7++; ?? ??? ?} ?? ?}?? ??? ??? ? ? ? ? ? ? ? ? ? ? ? ?? ?if (flag7 == 0) ?? ??? ?cout << "您輸入的課程編號不存在,請重新操作?。。? << endl; ? ?? } //展示學(xué)生選課信息? ?void generateSSelectionInfo(classInfo * c, gradeInfo * g, student * s, int courseNum, int studentNum) { ?? ?cout << "學(xué)生選課信息如下: " << endl << endl; ?? ?for (int j = 0; j < studentNum; j++) ?? ?{ ?? ? ? ?cout << "學(xué)號 ? ?:" << s[j].getStudentNumber() << " 姓名 ? ?:" << s[j].getName() << endl; ?? ??? ?for (int k = 0; k < courseNum; k++) ?? ??? ?{ ?? ??? ??? ?if (isInThisCourse(g, c[k].getCourseNumber(), s[j].getStudentNumber(), courseNum)) ?? ??? ??? ??? ?c[k].searchBasicInfo(); ?? ??? ?} ?? ??? ?cout << endl;?? ??? ??? ??? ??? ??? ??? ? ?? ?}?? ? } //判斷老師是否帶這門課? ?bool isTeacherClass(classInfo * c, string courseNumber, string userName, int courseNum) { ?? ?for (int i = 0; i < courseNum; i++) ?? ??? ?if(c[i].getJobNumberOfTeacher() == userName && courseNumber == c[i].getCourseNumber()) ?? ??? ?{ ?? ??? ??? ?return true; ?? ??? ??? ?break; ?? ??? ?} } //判斷學(xué)生是否有這門課? ?bool isInThisCourse(gradeInfo * g, string courseNumber, string studentNumber, int courseNum) { ?? ?bool temp = false; ?? ?for (int i = 0; i < courseNum; i++) ?? ?{ ?? ??? ?if(g[i].isStudentHere(studentNumber) && courseNumber== g[i].getCourseNumber()) ?? ??? ? ? ?temp = true;?? ? ? ? ?? ?} ?? ?return temp; }
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- C++實(shí)現(xiàn)教工考勤信息管理系統(tǒng)
- C++實(shí)現(xiàn)教職工信息管理系統(tǒng)課程設(shè)計
- C++實(shí)現(xiàn)教職工信息管理系統(tǒng)
- C++實(shí)現(xiàn)教職工管理系統(tǒng)課程設(shè)計
- C++實(shí)現(xiàn)高校教室管理系統(tǒng)
- C++實(shí)現(xiàn)教師管理系統(tǒng)
- C++實(shí)現(xiàn)評教管理系統(tǒng)
- C++實(shí)現(xiàn)簡單的學(xué)生管理系統(tǒng)
- C++學(xué)生信息管理系統(tǒng)
- 學(xué)生成績管理系統(tǒng)C++實(shí)現(xiàn)代碼
相關(guān)文章
C語言實(shí)現(xiàn)CRC校驗(yàn)算法的示例詳解
CRC(Cyclic Redundancy Check,循環(huán)冗余校驗(yàn))是一種常用的錯誤檢測技術(shù),用于驗(yàn)證數(shù)據(jù)在傳輸或存儲過程中是否發(fā)生了錯誤,本文主要介紹了C語言如何實(shí)現(xiàn)CRC校驗(yàn)算法,需要的可以參考一下2023-08-08