#include<iostream>
#include<fstream>
#include<cmath>
#include<algorithm>
#include<time.h>
#include<ctime>
#include<Windows.h>
#define STUDENT_FILE "Student.txt"
#define TEACHER_FILE "Teacher.txt"
#define MANAGER_FILE "Manage.txt"
#define JOURNAL_FILE "Journal.txt"
#define SCORE_FILE "Score.txt"
#define QUESTION_FILE "Question.txt"
using namespace std;
struct stu_t {
string Id, Name, Pwd;
bool Subject;
} peo[1005];
struct nod {
string id;
int chinese, maths, english, politics, history, geography, biology, other, total;
} stu[1005], stu2[1005];
struct tim {
int year, mon, mday, hour, min, sec;
} tim;
struct no {
string time_1, time_2, name, str;
string subject;
} p[1005];
bool state = false;
char port;
int tm_year() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_year + 1900;
}
int tm_mon() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_mon + 1;
}
int tm_day() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_mday;
}
int tm_hour() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_hour;
}
int tm_min() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_min;
}
int tm_sec() {
struct tm t;
time_t now;
time(&now);
localtime_s(&t, &now);
return t.tm_sec;
}
bool cmp(nod x, nod y) {
return x.total > y.total;
}
void setWindowStyle() {
system("title 量化管理系统[1.0.3]");
system("color f0");
system("mode con cols=80 lines=70");
return;
}
void Student(string Id, string Name, string Pwd, bool Subject) {
while (true) {
if (Subject) {
cout << "=====================欢迎来到量化管理系统=====================" << endl;
cout << "(每次输入后按enter继续)" << endl;
cout << "欢迎班干部 : " << Name << " 登录!" << endl;
cout << "\t\t------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.查看量化 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.查看排名 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.修改密码 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 4.提出疑问 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 5.修改量化 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.注销登录 |\n";
cout << "\t\t| |\n";
cout << "\t\t------------------------------\n";
cout << "请您输入你要执行的操作(1-5 0退出):";
}
else {
cout << "=====================欢迎来到量化管理系统=====================" << endl;
cout << "(每次输入后按enter继续)" << endl;
cout << "欢迎学生 : " << Name << " 登录!" << endl;
cout << "\t\t------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.查看量化 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.查看排名 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.修改密码 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 4.提出疑问 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.注销登录 |\n";
cout << "\t\t| |\n";
cout << "\t\t------------------------------\n";
cout << "请您输入你要执行的操作(1-4 0退出):";
}
string select = "0";
cin >> select;
if (select == "1") {//查看量化
ifstream ifs;
ifs.open("E:\True score.txt");
int fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
if (fid == Id) {
cout << "你的量化如下: " << endl;
cout << "语文----数学----英语----政治----历史----地理----生物----其他----总分----" << endl;
cout << "|" << fchinese << "\t|" << fmaths << "\t|" << fenglish
<< "\t|" << fpolitics << "\t|" << fhistory
<< "\t|" << fgeography << "\t|" << fbiology << "\t|" << fother << "\t|"
<< ftotal << "\t|" << endl;
cout << "------------------------------------------------------------------------" << endl;
system("pause");
system("cls");
break;
}
}
}
else if (select == "2") { //查看排名
ifstream ifs;
ifs.open("E:\True score.txt");
int k = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu2[k].id = fid;
stu2[k].chinese = fchinese;
stu2[k].maths = fmaths;
stu2[k].english = fenglish;
stu2[k].politics = fpolitics;
stu2[k].history = fhistory;
stu2[k].geography = fgeography;
stu2[k].biology = fbiology;
stu2[k].other = fother;
stu2[k++].total = ftotal;
}
sort(stu2 + 1, stu2 + 43 + 1, cmp);
for (int i = 1; i <= 43; i++) {
if (Id == stu2[i].id)cout << "你的总分是 " << stu2[i].total << " 位居第 " << i << " 名" << endl;
//cout << stu2[i].id << " ";
}
system("pause");
system("cls");
}
else if (select == "3") { //修改账号
ifstream ifs;
ofstream ofs;
string slect = "0";
string fName, fId, fPwd, name, id;
int i = 1;
bool fSubject, flag = false;
while (true) {
cout << "请输入修改后密码(必须为字符串): ";
cin >> slect;
if (slect.size() == 1) {
cout << "密码必须为字符串(任意键继续)" << endl;
continue;
}
else break;
}
ifs.open(STUDENT_FILE);
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
peo[i].Id = fId, peo[i].Name = fName, peo[i].Pwd = fPwd, peo[i].Subject = fSubject;
if (Id == fId && Name == fName && Pwd == fPwd) peo[i].Pwd = slect;
i++;
}
ifs.close();
ofs.open(STUDENT_FILE, ios::trunc);
for (int j = 1; j < i; j++)
ofs << peo[j].Id << '\t' << peo[j].Name << '\t' << peo[j].Pwd << '\t' << peo[j].Subject << endl;
ofs.close();
cout << "修改成功(任意键继续)" << endl;
system("pause");
system("cls");
}
else if (select == "4") {//提出疑问
ofstream ofs;
ofs.open(QUESTION_FILE, ios::app);
string str;
int subject;
cout << "请输入你要提出疑问的科目(1-7 0退出):";
cin >> subject;
if (subject == 0) {
system("pause");
system("cls");
continue;
}
cout << "请输入你的疑问(文字):";
cin >> str;
cout << "发送成功!" << endl;
system("pause");
system("cls");
tim.year = tm_year();
tim.mon = tm_mon();
tim.mday = tm_day();
tim.hour = tm_hour();
tim.min = tm_min();
tim.sec = tm_sec();
ofs << tim.year << "-" << tim.mon << "-" << tim.mday << " " << tim.hour << ":" << tim.min << ":" << tim.sec;
ofs << " " << Name << " " << subject << " " << str << endl;
ofs.close();
}
else if (select == "5") { //修改量化
ifstream ifs;
ofstream ofs, fs;
ifs.open("E:\True score.txt");
if (!ifs.is_open()) {
cout << "文件打开失败(任意键继续)" << endl;
system("pause");
system("cls");
continue;
}
int jk = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu[jk].id = fid;
stu[jk].chinese = fchinese;
stu[jk].english = fenglish;
stu[jk].maths = fmaths;
stu[jk].politics = fpolitics;
stu[jk].history = fhistory;
stu[jk].geography = fgeography;
stu[jk].biology = fbiology;
stu[jk].other = fother;
stu[jk++].total = ftotal;
}
//for (int i = 1; i < jk; i++)cout << stu[i].id << endl;
ifs.close();
int s_i = 1, s[1005], sum, k;
bool f1 = false, f2 = false;
lop:
f1 = false; f2 = false; s_i = 1;
cout << "请输入修改人学号(空格隔开 0结束): ";
for (s_i = 1; s[s_i - 1] != 0; s_i++) {
cin >> s[s_i];
if (s[1] == 0) { system("pause"); system("cls"); f1 = true; break; }
if (s[s_i] < 0 || s[s_i] > 43) f2 = true;
}
if (f1) continue;
if (f2) { cout << "输入有误!请重新输入\n"; goto lop; }
cout << "请输入修改科目(1-8): ";
while (cin >> k) {
if (k < 1 || k > 8) { cout << "输入有误!请重新输入\n请输入修改科目(1-8): "; }
else break;
}
cout << "请输入修改分数(正整数加分(不加 + ) 负整数减分): ";
cin >> sum;
for (int i = 1; i < s_i; i++) {
if (k == 1) stu[s[i]].chinese += sum;
else if (k == 2) stu[s[i]].maths += sum;
else if (k == 3) stu[s[i]].english += sum;
else if (k == 4) stu[s[i]].politics += sum;
else if (k == 5) stu[s[i]].history += sum;
else if (k == 6) stu[s[i]].geography += sum;
else if (k == 7) stu[s[i]].biology += sum;
else if (k == 8) stu[s[i]].other += sum;
}
ofs.open(SCORE_FILE, ios::trunc);
fs.open("E:\True score.txt", ios::trunc);
for (int i = 1; i < jk; i++) {
ofs << stu[i].id << "\t" << stu[i].chinese << "\t" << stu[i].maths << "\t" << stu[i].english << "\t";
ofs << stu[i].politics << "\t" << stu[i].history << "\t";
ofs << stu[i].geography << "\t" << stu[i].biology << "\t" << stu[i].other << "\t";
stu[i].total = stu[i].chinese + stu[i].maths + stu[i].english
+ stu[i].politics + stu[i].history
+ stu[i].geography + stu[i].biology + stu[i].other;
ofs << stu[i].total << endl;
fs << stu[i].id << "\t" << stu[i].chinese << "\t" << stu[i].maths << "\t" << stu[i].english << "\t";
fs << stu[i].politics << "\t" << stu[i].history << "\t";
fs << stu[i].geography << "\t" << stu[i].biology << "\t" << stu[i].other << "\t";
fs << stu[i].total << endl;
}
ofs.close();
fs.close();
cout << "修改成功!" << endl;
ofs.open(JOURNAL_FILE, ios::app);
fs.open("E:\True journal.txt", ios::app);
tim.year = tm_year();
tim.mon = tm_mon();
tim.mday = tm_day();
tim.hour = tm_hour();
tim.min = tm_min();
tim.sec = tm_sec();
printf(" %d-%d-%d %d:%d:%d\n", tim.year, tim.mon, tim.mday, tim.hour, tim.min, tim.sec);
cout << "\t姓名: " << Name << endl;
printf("\t修改人数: %d\n\t科目: %d\n\t波动分数: %d\n\t修改人学号: ", s_i - 2, k, sum);
for (int i = 1; i < s_i - 1; i++) cout << s[i] << " ";
cout << endl;
cout << "已将您的修改信息记录到日志(任意键继续)" << endl;
ofs << tim.year << "-" << tim.mon << "-" << tim.mday << " " << tim.hour << ":" << tim.min << ":" << tim.sec;
ofs << " " << Name << " " << s_i - 2 << " " << k << " " << sum << " ";
fs << tim.year << "-" << tim.mon << "-" << tim.mday << " " << tim.hour << ":" << tim.min << ":" << tim.sec;
fs << " " << Name << " " << s_i - 2 << " " << k << " " << sum << " ";
for (int i = 1; i < s_i - 1; i++) {
ofs << s[i] << ",";
fs << s[i] << ",";
}
ofs << endl;
fs << endl;
ofs.close();
fs.close();
system("pause");
system("cls");
}
else if (select == "0") {
cout << "欢迎下次使用!" << endl;
system("pause");
system("cls");
return;
}
else {
cout << "操作不合规!" << endl;
system("pause");
system("cls");
}
}
return;
}
void Teacher(string Id, string Name, string Pwd) {
while (true) {
ifstream ifs(QUESTION_FILE);
string time_1, time_2, name, str;
string subject;
int num = 0;
while (ifs >> time_1 && ifs >> time_2 && ifs >> name && ifs >> subject && ifs >> str) {
if (Id == subject)num++;
}
ifs.close();
cout << "=====================欢迎来到量化管理系统=====================" << endl;
cout << "(每次输入后按enter继续)" << endl;
if (num <= 15) cout << "欢迎教师 : " << Name << " 登录!" << " 您有共有 " << num << " 条消息" << endl;
else cout << "欢迎教师 : " << Name << " 登录!" << " 您有共有 15+ 条消息" << endl;
cout << "\t\t------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.修改量化 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.查看排名 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.查看日志 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 4.查看账号 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 5.注册账号 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 6.导出数据 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 7.查看疑问 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.注销登录 |\n";
cout << "\t\t| |\n";
cout << "\t\t------------------------------\n";
cout << "请您输入您要执行的操作(1-7 0退出):";
string select = "0";
cin >> select;
if (select == "1") {//修改量化
ifstream ifs;
ofstream ofs, fs;
ifs.open("E:\True score.txt");
if (!ifs.is_open()) {
cout << "文件打开失败(任意键继续)" << endl;
system("pause");
system("cls");
continue;
}
int jk = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu[jk].id = fid;
stu[jk].chinese = fchinese;
stu[jk].english = fenglish;
stu[jk].maths = fmaths;
stu[jk].politics = fpolitics;
stu[jk].history = fhistory;
stu[jk].geography = fgeography;
stu[jk].biology = fbiology;
stu[jk].other = fother;
stu[jk++].total = ftotal;
}
//for (int i = 1; i < jk; i++)cout << stu[i].id << endl;
ifs.close();
int s_i = 1, s[1005], sum, k;
bool f1 = false, f2 = false;
lop:
f1 = false; f2 = false; s_i = 1;
cout << "请输入修改人学号(空格隔开 0结束): ";
for (s_i = 1; s[s_i - 1] != 0; s_i++) {
cin >> s[s_i];
if (s[1] == 0) { system("pause"); system("cls"); f1 = true; break; }
if (s[s_i] < 0 || s[s_i] > 43) f2 = true;
}
if (f1) continue;
if (f2) { cout << "输入有误!请重新输入\n"; goto lop; }
cout << "请输入修改科目(1-8): ";
while (cin >> k) {
if (k < 1 || k > 8) { cout << "输入有误!请重新输入\n请输入修改科目(1-8): "; }
else break;
}
cout << "请输入修改分数(正整数加分(不加 + ) 负整数减分): ";
cin >> sum;
for (int i = 1; i < s_i; i++) {
if (k == 1) stu[s[i]].chinese += sum;
else if (k == 2) stu[s[i]].maths += sum;
else if (k == 3) stu[s[i]].english += sum;
else if (k == 4) stu[s[i]].politics += sum;
else if (k == 5) stu[s[i]].history += sum;
else if (k == 6) stu[s[i]].geography += sum;
else if (k == 7) stu[s[i]].biology += sum;
else if (k == 8) stu[s[i]].other += sum;
}
ofs.open(SCORE_FILE, ios::trunc);
fs.open("E:\True score.txt", ios::trunc);
for (int i = 1; i < jk; i++) {
ofs << stu[i].id << "\t" << stu[i].chinese << "\t" << stu[i].maths << "\t" << stu[i].english << "\t";
ofs << stu[i].politics << "\t" << stu[i].history << "\t";
ofs << stu[i].geography << "\t" << stu[i].biology << "\t" << stu[i].other << "\t";
stu[i].total = stu[i].chinese + stu[i].maths + stu[i].english
+ stu[i].politics + stu[i].history
+ stu[i].geography + stu[i].biology + stu[i].other;
ofs << stu[i].total << endl;
fs << stu[i].id << "\t" << stu[i].chinese << "\t" << stu[i].maths << "\t" << stu[i].english << "\t";
fs << stu[i].politics << "\t" << stu[i].history << "\t";
fs << stu[i].geography << "\t" << stu[i].biology << "\t" << stu[i].other << "\t";
fs << stu[i].total << endl;
}
ofs.close();
fs.close();
cout << "修改成功!" << endl;
ofs.open(JOURNAL_FILE, ios::app);
fs.open("E:\True journal.txt", ios::app);
tim.year = tm_year();
tim.mon = tm_mon();
tim.mday = tm_day();
tim.hour = tm_hour();
tim.min = tm_min();
tim.sec = tm_sec();
printf(" %d-%d-%d %d:%d:%d\n", tim.year, tim.mon, tim.mday, tim.hour, tim.min, tim.sec);
cout << "\t姓名: " << Name << endl;
printf("\t修改人数: %d\n\t科目: %d\n\t波动分数: %d\n\t修改人学号: ", s_i - 2, k, sum);
for (int i = 1; i < s_i - 1; i++) cout << s[i] << " ";
cout << endl;
cout << "已将您的修改信息记录到日志(任意键继续)" << endl;
ofs << tim.year << "-" << tim.mon << "-" << tim.mday << " " << tim.hour << ":" << tim.min << ":" << tim.sec;
ofs << " " << Name << " " << s_i - 2 << " " << k << " " << sum << " ";
fs << tim.year << "-" << tim.mon << "-" << tim.mday << " " << tim.hour << ":" << tim.min << ":" << tim.sec;
fs << " " << Name << " " << s_i - 2 << " " << k << " " << sum << " ";
for (int i = 1; i < s_i - 1; i++) {
ofs << s[i] << ",";
fs << s[i] << ",";
}
ofs << endl;
fs << endl;
ofs.close();
fs.close();
system("pause");
system("cls");
}
else if (select == "2") { //查看排名
ifstream ifs;
ifs.open(SCORE_FILE);
int k = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu2[k].id = fid;
stu2[k].chinese = fchinese;
stu2[k].maths = fmaths;
stu2[k].english = fenglish;
stu2[k].politics = fpolitics;
stu2[k].history = fhistory;
stu2[k].geography = fgeography;
stu2[k].biology = fbiology;
stu2[k].other = fother;
stu2[k++].total = ftotal;
}
sort(stu2 + 1, stu2 + 44, cmp);
cout << "学号====语文====数学====英语====政治====历史====地理====生物====其他====总分====" << '\n';
for (int i = 1; i <= 43; i++) {
cout << stu2[i].id << "\t|" << stu2[i].chinese << "\t|" << stu2[i].maths << "\t|" << stu2[i].english
<< "\t|" << stu2[i].politics << "\t|" << stu2[i].history
<< "\t|" << stu2[i].geography << "\t|" << stu2[i].biology
<< "\t|" << stu2[i].other << "\t|" << stu2[i].total << "\t|" << '\n';
}
cout << "================================================================================" << '\n';
system("pause");
system("cls");
}
else if (select == "3") { //查看日志
ifstream ifs(JOURNAL_FILE, ios::in);
char str[1005];
while (ifs.getline(str, 1005)) {
cout << str << endl;
}
system("pause");
system("cls");
}
else if (select == "4") { //查看账号
cout << "请选择查看内容(1/2/0) : " << endl;
cout << " 1.查看所有学生" << endl;
cout << " 2.查看所有教师" << endl;
cout << " 0.返回" << endl;
string slect = "0";//接受用户选择
string fId, fName, fPwd;
bool fSubject;
long long id = 1;
ifstream ifs;
cin >> slect;
if (slect == "1") {
ifs.open(STUDENT_FILE);
//查看学生
cout << "所有的学生信息如下 : " << endl;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
cout << "第 " << id++ << " 名学生:" << endl;
cout << "\t学号:" << fId << endl;
cout << "\t姓名:" << fName << endl;
cout << "\t密码:" << fPwd << endl;
if (fSubject) cout << "\t是否为课代表:" << "是" << endl;
else cout << "\t是否为课代表:" << "否" << endl;
}
}
else if (slect == "2") {
ifs.open(TEACHER_FILE);
//查看教师
cout << "所有的教师信息如下 : " << endl;
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
cout << "第 " << id++ << " 名教师:" << endl;
cout << "\t职工号:" << fId << endl;
cout << "\t姓名:" << fName << endl;
}
}
else if (slect == "0") {
cout << "按任意键返回" << endl;
}
else {
cout << "操作不合规!" << endl;
}
system("pause");
system("cls");
id = 1;
}
else if (select == "5") { //注册账号
//提示
cout << "请输入添加账号类型(1/2/0)" << endl;
cout << " 1.添加学生" << endl;
cout << " 2.添加老师" << endl;
cout << " 0.返回" << endl;
string fileName;//操作文件名
string tip;//提示id号
ifstream ifs;
ofstream ofs;//文件操作对象
string slect = "0";
while (true) {
cin >> slect;
if (slect == "1") {
//学生
fileName = STUDENT_FILE;
tip = "请输入学号 : ";
break;
}
else if (slect == "2") {
//教师
fileName = TEACHER_FILE;
tip = "请输入职工编号 : ";
break;
}
else if (slect == "0") {
cout << "按任意键返回" << endl;
system("pause");
system("cls");
return;
}
else {
cout << "输入不合规(任意键继续)" << endl;
system("pause");
continue;
}
}
//利用追加方式 写文件
ofs.open(fileName, ios::out | ios::app);
ifs.open(fileName);
int id, fId;//学号、职工号
string name, fName;//用户名
string pwd, fPwd;//密码
bool fSubject, subject;
bool flag = false;
while (true) {
if (slect == "1" || slect == "2") {
cout << tip;
cin >> id;
}
cout << "请输入注册姓名 : ";
cin >> name;
if (name.size() == 1) {
cout << "姓名必须为字符串(任意键继续)" << endl;
system("pause");
continue;
}
cout << "请输入密码(字符串) : ";
cin >> pwd;
if (pwd.size() == 1) {
cout << "密码必须为字符串(任意键继续)" << endl;
system("pause");
continue;
}
if (slect == "1") {
cout << "是否为课代表(0表示否/1表示是): ";
cin >> subject;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
if (fId == id || fName == name || fPwd == pwd) {
flag = true;
cout << "编号/用户名/密码 有重复(任意键继续)" << endl;
system("pause");
break;
}
}
}
else if (slect == "2") {
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
if (fId == id || fName == name || fPwd == pwd) {
flag = true;
cout << "编号/用户名/密码 有重复(任意键继续)" << endl;
system("pause");
break;
}
}
}
if (flag == false) {
break;
}
flag = false;
}
//向文件中添加数据
if (slect == "1" || slect == "2") {
ofs << id << "\t";
}
ofs << name << "\t" << pwd;
if (slect == "1")ofs << "\t" << subject << endl;
else cout << endl;
cout << "添加成功(任意键继续)" << endl;
system("pause");
system("cls");
ofs.close();
}
else if (select == "6") { //导出数据
ifstream ifs;
ofstream ofs;
cout << "请选择导出数据(1/2/0):" << endl;
cout << "\t1.导出修改日志\n";
cout << "\t2.导出量化排名\n";
cout << "\t0.返回\n";
string slect = "0";
cin >> slect;
if (slect == "1") {
ifs.open(JOURNAL_FILE);
ofs.open("日志.csv", ios::out | ios::trunc);
string str_year, str_hour, str_name, str_people, str_subject, str_score;
string str_id;
ofs << "日期,时间,修改人,修改人数,科目,分数,学号" << endl;
while (ifs >> str_year && ifs >> str_hour && ifs >> str_name
&& ifs >> str_people && ifs >> str_subject && ifs >> str_score && ifs >> str_id) {
ofs << str_year << "," << str_hour << "," << str_name << "," << str_people << "," << str_subject << "," << str_score << "," << str_id << endl;
//while (ifs >> str_id && str_id != 10)ofs << str_id;
//ofs << endl;
}
ifs.close();
ofs.close();
cout << "导出成功 以导出到同文件夹下的 日志.csv!" << endl;
system("pause");
system("cls");
}
else if (slect == "2") {
ifstream fin;
ifs.open(SCORE_FILE);
ofs.open("量化.csv", ios::out | ios::trunc);
int k = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string id, name, pwd, subject, fid;
ofs << "学号,排名,姓名,语文,数学,英语,政治,历史,地理,生物,其他,总分" << endl;
while (ifs >> id && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu2[k].id = id, stu2[k].chinese = fchinese, stu2[k].maths = fmaths, stu2[k].english = fenglish;
stu2[k].politics = fpolitics, stu2[k].history = fhistory, stu2[k].geography = fgeography;
stu2[k].biology = fbiology, stu2[k].other = fother, stu2[k++].total = ftotal;
}
sort(stu2 + 1, stu2 + 44, cmp);
//cout << stu2[1].id;
//for (int i = 1; i <= 43; i++) {
// cout << stu2[i].id << endl;
//}
for (int i = 1; i <= 43; i++) {
fin.open(STUDENT_FILE);
while (fin >> fid && fin >> name && fin >> pwd && fin >> subject) {
if (stu2[i].id == fid) {
ofs << fid << "," << i << "," << name << ",";
break;
}
}
ofs << stu2[i].chinese << "," << stu2[i].maths << "," << stu2[i].english << ","
<< stu2[i].politics << "," << stu2[i].history << ","
<< stu2[i].geography << "," << stu2[i].biology << ","
<< stu2[i].other << "," << stu2[i].total << endl;
fin.close();
}
/*
while (ifs >> id && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> ftotal) {
while (fin >> fid && fin >> name && fin >> pwd && fin >> subject) {
if (fid == id) {
ofs << k++ << "," << name << ",";
break;
}
}
ofs << fchinese << "," << fmaths << "," << fenglish << "," << fpolitics << "," << fhistory << ","
<< fgeography << "," << fbiology << "," << ftotal << endl;
}
*/
ifs.close();
ofs.close();
cout << "导出成功 以导出到同文件夹下的 量化.csv!" << endl;
system("pause");
system("cls");
}
else if (slect == "0") {
system("pause");
system("cls");
}
else {
cout << "操作不合规(任意键继续)" << endl;
system("pause");
system("cls");
}
}
else if (select == "7") {//查看疑问
ifstream ifs;
ifs.open(QUESTION_FILE);
string time_1, time_2, name, str;
string subject;
int num = 0;
string n;
while (ifs >> time_1 && ifs >> time_2 && ifs >> name && ifs >> subject && ifs >> str)
if (Id == subject)
cout << time_1 << " " << time_2 << " " << name << " " << str << endl;
cout << "是否永久清空消息栏(T/F):";
cin >> n;
int k = 1;
if (n == "T") {
while (ifs >> time_1 && ifs >> time_2 && ifs >> name && ifs >> subject && ifs >> str) {
if (Id != subject) p[k].time_1 = time_1, p[k].time_2 = time_2, p[k].name = name, p[k].subject = subject, p[k++].str = str;
}
ofstream ofs;
ofs.open(QUESTION_FILE, ios::out | ios::trunc);
for (int i = 1; i < k; i++)
ofs << time_1 << " " << time_2 << " " << name << " " << subject << " " << str << endl;
ofs.close();
}
system("pause");
system("cls");
ifs.close();
}
else if (select == "0") {
cout << "欢迎下次使用!" << endl;
system("pause");
system("cls");
return;
}
else {
cout << "操作不合规(任意键继续)" << endl;
system("pause");
system("cls");
}
}
return;
}
void Manage(string Name, string Pwd) {
while (true) {
cout << "=====================欢迎来到量化管理系统=====================" << endl;
cout << "(每次输入后按enter继续)" << endl;
cout << "欢迎管理员 : " << Name << " 登录!" << endl;
cout << "\t\t------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.注册账号 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.查看日志 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.查看账号 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 4.修改账号 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 5.查看排名 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 6.导出数据 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.注销登录 |\n";
cout << "\t\t| |\n";
cout << "\t\t------------------------------\n";
cout << "请您输入您要执行的操作(1-6 0退出):";
string select = "0";
cin >> select;
if (select == "1") {//注册
//提示
cout << "请输入添加账号类型(1/2/3/0)" << endl;
cout << " 1.添加学生" << endl;
cout << " 2.添加老师" << endl;
cout << " 3.添加管理员" << endl;
cout << " 0.返回" << endl;
string fileName;//操作文件名
string tip;//提示id号
ifstream ifs;
ofstream ofs;//文件操作对象
string slect = "0";
while (true) {
cin >> slect;
if (slect == "1") {
//学生
fileName = STUDENT_FILE;
tip = "请输入学号(1-43) : ";
break;
}
else if (slect == "2") {
//教师
fileName = TEACHER_FILE;
tip = "请输入职工编号 : ";
break;
}
else if (slect == "3") {
//管理员
fileName = MANAGER_FILE;
break;
}
else if (slect == "0") {
system("pause");
system("cls");
return;
}
else {
cout << "输入不合规(任意键继续)" << endl;
system("pause");
continue;
}
}
//利用追加方式 写文件
ofs.open(fileName, ios::out | ios::app);
ifs.open(fileName);
int id, fId;//学号、职工号
string name, fName;//用户名
string pwd, fPwd;//密码
bool fSubject, subject;
bool flag = false;
while (true) {
if (slect == "1" || slect == "2") {
cout << tip;
cin >> id;
}
cout << "请输入账号名 : ";
cin >> name;
if (name.size() == 1) {
cout << "姓名必须为字符串(任意键继续)" << endl;
system("pause");
continue;
}
cout << "请输入密码(字符串) : ";
cin >> pwd;
if (pwd.size() == 1) {
cout << "密码必须为字符串(任意键继续)" << endl;
system("pause");
continue;
}
if (slect == "1") {
cout << "是否为课代表(0表示否/1表示是): ";
cin >> subject;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
if (fId == id || fName == name || fPwd == pwd) {
flag = true;
cout << "编号/用户名/密码 有重复(任意键继续)" << endl;
system("pause");
break;
}
}
}
else if (slect == "2") {
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
if (fId == id || fName == name || fPwd == pwd) {
flag = true;
cout << "编号/用户名/密码 有重复(任意键继续)" << endl;
system("pause");
break;
}
}
}
else {
while (ifs >> fName && ifs >> fPwd) {
if (fName == name || fPwd == pwd) {
flag = true;
cout << "用户名/密码 有重复(任意键继续)" << endl;
system("pause");
break;
}
}
}
if (flag == false) {
break;
}
flag = false;
}
//向文件中添加数据
if (slect == "1" || slect == "2") {
ofs << id << "\t";
}
ofs << name << "\t" << pwd;
if (slect == "1")ofs << "\t" << subject << endl;
else cout << endl;
cout << "添加成功(任意键继续)" << endl;
system("pause");
system("cls");
ofs.close();
}
else if (select == "2") { //查看日志
ifstream ifs(JOURNAL_FILE, ios::in);
char str[1005];
while (ifs.getline(str, 1005)) {
cout << str << endl;
}
system("pause");
system("cls");
}
else if (select == "3") { //查看账号
cout << "请选择查看内容(1/2/3/0) : " << endl;
cout << " 1.查看所有学生" << endl;
cout << " 2.查看所有教师" << endl;
cout << " 3.查看所有管理员" << endl;
cout << " 0.返回" << endl;
string slect = "0";//接受用户选择
string fId, fName, fPwd;
bool fSubject;
long long id = 1;
ifstream ifs;
cin >> slect;
if (slect == "1") {
ifs.open(STUDENT_FILE);
//查看学生
cout << "所有的学生信息如下(任意键继续) : " << endl;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
cout << "第 " << id++ << " 名学生:" << endl;
cout << "\t学号:" << fId << endl;
cout << "\t姓名:" << fName << endl;
cout << "\t密码:" << fPwd << endl;
if (fSubject) cout << "\t是否为课代表:" << "是" << endl;
else cout << "\t是否为课代表:" << "否" << endl;
}
}
else if (slect == "2") {
ifs.open(TEACHER_FILE);
//查看教师
cout << "所有的教师信息如下(任意键继续) : " << endl;
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
cout << "第 " << id++ << " 名教师:" << endl;
cout << "\t职工号:" << fId << endl;
cout << "\t姓名:" << fName << endl;
cout << "\t密码:" << fPwd << endl;
}
}
else if (slect == "3") {
ifs.open(MANAGER_FILE);
//查看管理员
cout << "所有的管理员信息如下(任意键继续) : " << endl;
while (ifs >> fName && ifs >> fPwd) {
cout << "第 " << id++ << " 名管理员:" << endl;
cout << "\t姓名:" << fName << endl;
}
}
else if (slect == "0") {
cout << "按任意键返回" << endl;
}
else {
cout << "操作不合规(任意键继续)" << endl;
}
system("pause");
system("cls");
id = 1;
}
else if (select == "4") { //修改账号
ifstream ifs;
ofstream ofs;
cout << "请选择修改账号(1/2/0) : " << endl;
cout << " 1.学生账号" << endl;
cout << " 2.教师账号" << endl;
cout << " 0.返回" << endl;
string slect = "0";
string fName, fId, fPwd, name, id;
int i = 1;
bool fSubject, flag = false;
cin >> slect;
if (slect == "1") {
ifs.open(STUDENT_FILE);
if (!ifs.is_open()) {
cout << "找不到文件(任意键继续)" << endl;
system("pause");
system("cls");
continue;
}
while (true) {
if (flag)break;
cout << "请输入学生学号: ";
cin >> id;
cout << "请输入学生姓名: ";
cin >> name;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
//与用户输入信息做对比
peo[i].Id = fId;
peo[i].Name = fName;
peo[i].Pwd = fPwd;
peo[i].Subject = fSubject;
if (fId == id && fName == name) {
cout << "学生查找成功(任意键继续)" << endl;
system("pause");
ifstream fin;
fin.open(STUDENT_FILE);
while (true) {
cout << "请输入修改后学生学号(1-43): ";
cin >> peo[i].Id;
while (fin >> fId && fin >> fName && fin >> fPwd && fin >> fSubject) {
int num = 0;
if (fId == peo[i].Id) {
num++;
}
if (num == 2) {
cout << "学号有重复(任意键继续)" << endl;
flag = true;
system("pause");
break;
}
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
while (true) {
cout << "请输入修改后学生姓名 : ";
cin >> peo[i].Name;
if (peo[i].Name.size() == 1) {
cout << "姓名必须为字符串(任意键继续)" << endl;
flag = true;
system("pause");
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
while (true) {
cout << "请输入修改后学生密码 : ";
cin >> peo[i].Pwd;
if (peo[i].Pwd.size() == 1) {
cout << "密码必须为字符串(任意键继续)" << endl;
flag = true;
system("pause");
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
cout << "请输入学生是否为课代表(0表示否/1表示是) : ";
cin >> peo[i].Subject;
flag = true;
cout << "修改成功(任意键继续)" << endl;
}
i++;
}
if (!flag) {
i = 1;
cout << "未查找到学生(任意键继续)" << endl;
system("pause");
continue;
}
if (flag) {
ofs.open(STUDENT_FILE, ios::trunc);
for (int j = 1; j < i; j++) {
ofs << peo[j].Id << "\t" << peo[j].Name << "\t" << peo[j].Pwd << "\t";
if (peo[j].Subject) ofs << 1 << endl;
else ofs << 0 << endl;
}
ofs.close();
ifs.close();
}
system("pause");
system("cls");
}
}
else if (slect == "2") {
ifs.open(TEACHER_FILE);
if (!ifs.is_open()) {
cout << "找不到文件(任意键继续)\n";
system("pause");
system("cls");
continue;
}
while (true) {
if (flag)break;
cout << "请输入教师职工号: ";
cin >> id;
cout << "请输入教师姓名: ";
cin >> name;
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
//与用户输入信息做对比
peo[i].Id = fId;
peo[i].Name = fName;
peo[i].Pwd = fPwd;
if (fId == id && fName == name) {
cout << "教师查找成功(任意键继续)" << endl;
system("pause");
ifstream fin;
fin.open(TEACHER_FILE);
while (true) {
cout << "请输入修改后教师职工号: ";
cin >> peo[i].Id;
while (fin >> fId && fin >> fName && fin >> fPwd && fin >> fSubject) {
int num = 0;
if (fId == peo[i].Id) {
num++;
}
if (num == 2) {
cout << "职工号有重复(任意键继续)" << endl;
flag = true;
system("pause");
break;
}
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
while (true) {
cout << "请输入修改后教师姓名 : ";
cin >> peo[i].Name;
if (peo[i].Name.size() == 1) {
cout << "姓名必须为字符串(任意键继续)" << endl;
flag = true;
system("pause");
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
while (true) {
cout << "请输入修改后教师密码 : ";
cin >> peo[i].Pwd;
if (peo[i].Pwd.size() == 1) {
cout << "密码必须为字符串(任意键继续)\n";
flag = true;
system("pause");
}
if (flag) {
flag = false;
}
else {
flag = false;
break;
}
}
flag = true;
cout << "修改成功(任意键继续)" << endl;
}
i++;
}
if (!flag) {
i = 1;
cout << "未查找到教师(任意键继续)" << endl;
system("pause");
continue;
}
if (flag) {
ofs.open(TEACHER_FILE, ios::trunc);
for (int j = 1; j < i; j++)
ofs << peo[j].Id << "\t" << peo[j].Name << "\t" << peo[j].Pwd << "\t";
ofs.close();
ifs.close();
}
system("pause");
system("cls");
}
}
else if (slect == "0") {
system("pause");
system("cls");
}
else {
cout << "操作不合规(任意键继续)" << endl;
system("pause");
}
}
else if (select == "5") { //查看排名
ifstream ifs;
ifs.open(SCORE_FILE);
int k = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string fid;
while (ifs >> fid && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu2[k].id = fid;
stu2[k].chinese = fchinese;
stu2[k].maths = fmaths;
stu2[k].english = fenglish;
stu2[k].politics = fpolitics;
stu2[k].history = fhistory;
stu2[k].geography = fgeography;
stu2[k].biology = fbiology;
stu2[k].other = fother;
stu2[k++].total = ftotal;
}
sort(stu2 + 1, stu2 + 44, cmp);
cout << "学号====语文====数学====英语====政治====历史====地理====生物====其他====总分====" << '\n';
for (int i = 1; i <= 43; i++) {
cout << stu2[i].id << "\t|" << stu2[i].chinese << "\t|" << stu2[i].maths << "\t|" << stu2[i].english
<< "\t|" << stu2[i].politics << "\t|" << stu2[i].history
<< "\t|" << stu2[i].geography << "\t|" << stu2[i].biology
<< "\t|" << stu2[i].other << "\t|" << stu2[i].total << "\t|" << '\n';
}
cout << "================================================================================" << '\n';
system("pause");
system("cls");
}
else if (select == "6") { //导出数据
ifstream ifs;
ofstream ofs;
cout << "请选择导出数据(1/2/0):" << endl;
cout << "\t1.导出修改日志\n";
cout << "\t2.导出量化排名\n";
cout << "\t0.返回\n";
string slect = "0";
cin >> slect;
if (slect == "1") {
ifs.open(JOURNAL_FILE);
ofs.open("日志.csv", ios::out | ios::trunc);
string str_year, str_hour, str_name, str_people, str_subject, str_score;
string str_id;
ofs << "日期,时间,修改人,修改人数,科目,分数,学号" << endl;
while (ifs >> str_year && ifs >> str_hour && ifs >> str_name
&& ifs >> str_people && ifs >> str_subject && ifs >> str_score && ifs >> str_id) {
ofs << str_year << "," << str_hour << "," << str_name << "," << str_people << "," << str_subject << "," << str_score << "," << str_id << endl;
//while (ifs >> str_id && str_id != 10)ofs << str_id;
//ofs << endl;
}
ifs.close();
ofs.close();
cout << "导出成功 以导出到同文件夹下的 日志.csv!" << endl;
system("pause");
system("cls");
}
else if (slect == "2") {
ifstream fin;
ifs.open("E:\True score.txt");
ofs.open("量化.csv", ios::out | ios::trunc);
int k = 1, fother, fchinese, fmaths, fenglish, fpolitics, fhistory, fgeography, fbiology, ftotal;
string id, name, pwd, subject, fid;
ofs << "学号,排名,姓名,语文,数学,英语,政治,历史,地理,生物,其他,总分" << endl;
while (ifs >> id && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> fother && ifs >> ftotal) {
stu2[k].id = id, stu2[k].chinese = fchinese, stu2[k].maths = fmaths, stu2[k].english = fenglish;
stu2[k].politics = fpolitics, stu2[k].history = fhistory, stu2[k].geography = fgeography;
stu2[k].biology = fbiology, stu2[k].other = fother, stu2[k++].total = ftotal;
}
sort(stu2 + 1, stu2 + 44, cmp);
//cout << stu2[1].id;
//for (int i = 1; i <= 43; i++) {
// cout << stu2[i].id << endl;
//}
for (int i = 1; i <= 43; i++) {
fin.open(STUDENT_FILE);
while (fin >> fid && fin >> name && fin >> pwd && fin >> subject) {
if (stu2[i].id == fid) {
ofs << fid << "," << i << "," << name << ",";
break;
}
}
ofs << stu2[i].chinese << "," << stu2[i].maths << "," << stu2[i].english << ","
<< stu2[i].politics << "," << stu2[i].history << ","
<< stu2[i].geography << "," << stu2[i].biology << ","
<< stu2[i].other << "," << stu2[i].total << endl;
fin.close();
}
/*
while (ifs >> id && ifs >> fchinese && ifs >> fmaths && ifs >> fenglish
&& ifs >> fpolitics && ifs >> fhistory && ifs >> fgeography
&& ifs >> fbiology && ifs >> ftotal) {
while (fin >> fid && fin >> name && fin >> pwd && fin >> subject) {
if (fid == id) {
ofs << k++ << "," << name << ",";
break;
}
}
ofs << fchinese << "," << fmaths << "," << fenglish << "," << fpolitics << "," << fhistory << ","
<< fgeography << "," << fbiology << "," << ftotal << endl;
}
*/
ifs.close();
ofs.close();
cout << "导出成功 以导出到同文件夹下的 量化.csv!" << endl;
system("pause");
system("cls");
}
else if (slect == "0") {
system("pause");
system("cls");
}
else {
cout << "操作不合规(任意键继续)" << endl;
system("pause");
system("cls");
}
}
else if (select == "0") {
cout << "欢迎下次使用(任意键继续)" << endl;
system("pause");
system("cls");
return;
}
else {
cout << "操作不合规(任意键继续)" << endl;
system("pause");
system("cls");
}
}
return;
}
void Login(string File, int port) {
//读文件
ifstream ifs;
ifs.open(File, ios::in);
//判断文件是否存在
if (!ifs.is_open()) {
cout << "文件不存在(任意键继续)" << endl;
ifs.close();
return;
}
//准备接受用户的信息
string id;
string name;
string pwd;
//判断身份
if (port == 1) {
cout << "请输入你的学号(1-43) : ";
cin >> id;
}
else if (port == 2) {
cout << "请输入您的职工号 : ";
cin >> id;
}
cout << "请输入账号名 : ";
cin >> name;
cout << "请输入密码 : ";
cin >> pwd;
if (port == 1) {
//学生身份验证
string fId;//从文件中读取id
string fName;//从文件中读取姓名
string fPwd;//从文件中读取密码
bool fSubject;
while (ifs >> fId && ifs >> fName && ifs >> fPwd && ifs >> fSubject) {
//与用户输入信息做对比
if (fId == id && fName == name && fPwd == pwd) {
cout << "学生验证成功(任意键继续)" << endl;
system("cls");
Student(id, name, pwd, fSubject);
//进入学生身份子菜单
return;
}
}
}
else if (port == 2) {
//教师身份验证
string fId;//从文件中读取id
string fName;//从文件中读取姓名
string fPwd;//从文件中读取密码
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
//与用户输入信息做对比
if (fId == id && fName == name && fPwd == pwd) {
cout << "教师验证成功(任意键继续)" << endl;
system("cls");
Teacher(id, name, pwd);
//进入教师身份子菜单
return;
}
}
}
else if (port == 3) {
//管理员身份验证
string fName;//从文件中读取姓名
string fPwd;//从文件中读取密码
while (ifs >> fName && ifs >> fPwd) {
//与用户输入信息做对比
if (fName == name && fPwd == pwd) {
cout << "管理员验证成功(任意键继续)" << endl;
system("cls");
Manage(name, pwd);
//进入管理员身份子菜单
return;
}
}
}
cout << "验证登录失败(任意键继续)" << endl;
system("pause");
system("cls");
return;
}
void Interface() {
cout << "=====================欢迎来到量化管理系统=====================" << endl;
cout << "(每次输入后按enter继续)" << endl;
cout << "\t\t------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.学 生 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.教 师 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.管 理 员 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.退 出 |\n";
cout << "\t\t| |\n";
cout << "\t\t------------------------------\n";
return;
}
void Main_Login() {
Interface();
cout << "请您输入您要登陆的端口(1/2/3/0):";
while (1) {
cin >> port;
if (port != '1' && port != '2' && port != '3' && port != '0') {
cout << endl << "输入错误请重新输入:";
}
else return;
}
return;
}
int main() {
setWindowStyle();
while (1) {
Main_Login();
switch (port) {
case '1':
Login(STUDENT_FILE, 1);
break;
case '2':
Login(TEACHER_FILE, 2);
break;
case '3':
Login(MANAGER_FILE, 3);
break;
case '0':
cout << "欢迎下次使用(任意键继续)" << endl;
system("pause");
return 0;
break;
}
}
return 0;
}
量化管理[1.0.3]
发布时间 2023-05-23 17:44:47作者: So_noSlack