有几个规格不同的机房,使用者众多,解决使用时间段重复,需要预约
有三种身份使用该程序
机房总共三个
首先进入登录页面,可选登录身份有
略
#include
using namespace std;
int main() {
int select = 0;//用于接受用户的选择
while (true) {
cout << "---------------------欢迎来到机房预约系统------------------------" << endl;
cout << endl << "请输入你的身份" << 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";
cout << "请输入您的选择: ";
cin >> select;//接受用户的选择
switch (select) {
case 1://学生身份
break;
case 2://老师身份
break;
case 3://管理员身份
break;
case 0://退出
break;
defalut:
cout << "输入有误,请重新选择!!!" << endl;
system("pause");
system("cls");
break;
}
}
system("pause");
return 0;
}
cout << "欢迎下次使用" << endl;
system("pause");
return 0;
学身类主要功能是可以通过类中的成员函数,实现预约实验室操作
Student.h
#pragma once
#include
#include"Identity.h"
using namespace std;
class Student:public Identity {
public:
//默认构造
Student();
//有参构造(学号、姓名、密码)
Student(int id, string name, string pwd);
//菜单界面
virtual void operMenu();
//申请预约
void applyOrder();
//查看我的预约
void showMyOrder();
//查看所有预约
void showAllOrder();
//取消预约
void cancelOrder();
};
Teacher.h
#pragma once
#include
using namespace std;
#include"Identity.h"
class Teacher:public Identity {
public:
//默认构造
Teacher();
//有参构造
Teacher(int id,string name,string pwd);
//菜单界面
virtual void operMenu();
//查看所有预约
void showAllOrder();
//审核预约
void examineOrder();
//职工编号
int emp_Id;
};
Admin.h
#pragma once
#include
using namespace std;
#include
#include"Identity.h"
#include"Student.h"
#include"Teacher.h"
class Admin:public Identity {
public:
//默认构造
Admin();
//有参构造
Admin(string name, string pwd);
//菜单界面
virtual void operMenu();
//添加账户
void addPerson();
//查看账户
void showPerson();
//查看机房信息
void showComputer();
//清空预约记录记录
void cleanFile();
//初始化容器
void initVector();
//检测重复,参数1:检测学号 学生/教师 参数2:检测类型,教师/学生
bool checkRepeat(int id, int type);
//学生容器
vector<Student>vStu;//获取文件中的学生数据进行比对,看是否重复添加
//教师容器
vector<Teacher>vTea;//获取文件中的教师数据进行比对,看是否重复添加
};
功能描述:
#pragma once
//管理员文件
#define ADMIN_FILE "admin.txt"
//学生文件
#define STUDENT_FILE "student.txt"
//教师文件
#define TEACHER_FILE "teacher.txt"
//机房信息文件
#define COMPUTER_FILE "computer.txt"
//订单文件
#define ORDER_FILE "order.txt"
在同级目录下创建代码中的文本文件
功能描述:
根据用户的选择,进入不同的身份登录
在机房预约的.cpp文件中添加全局函数
void LoginIn(string filename,int type)
参数说明:
void LoginIn(string filename, int type) {
Identity* person = NULL;
ifstream ifs;
ifs.open(filename, ios::in);
if (!ifs.is_open()) {
cout << "文件不存在" << endl;
ifs.close();
return;
}
//预制变量接收用户输入信息
int id = 0;
string name;
string pwd;
if (type == 1) {//学生登录
cout << "请输入你的学号" << endl;
cin >> id;
}
else if (type == 2) {//教师登录
cout << "请输入你的职工号" << endl;
cin >> id;
}
cout << "请输入用户名: " << endl;
cin >> name;
cout << "请输入密码: " << endl;
cin >> pwd;
//对用户输入的信息进行核验
if (type == 1) {
//学生登录验证
}
else if (type == 2) {
//教师登录验证
}
else if (type == 3) {
//管理员登录
}
cout << "验证登录失败" << endl;
system("pause");
system("cls");
return;
}
在选择时利用多态
if (type == 1) {
//学生登录验证
int fId;
string fName;
string fPwd;
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
if (fId == id && fName == name && fPwd == pwd) {
cout << "验证成功" << endl;
system("pause");
system("cls");
person = new Student(id, name, pwd);
return;
}
}
}
else if (type == 2) {
//教师登录验证
int fId;
string fName;
string fPwd;
while (ifs >> fId && ifs >> fName && ifs >> fPwd) {
if (fId == id && fName == name && fPwd == pwd) {
cout << "验证成功" << endl;
system("pause");
system("cls");
person = new Teacher(id, name, pwd);
return;
}
}
}
else if (type == 3) {
//管理员登录
string fName;
string fPwd;
while (ifs >> fName && ifs >> fPwd) {
if (fName == name && fPwd == pwd) {
cout << "验证成功" << endl;
system("pause");
system("cls");
person = new Admin( name, pwd);
managerMenu(person);
return;
}
}
}
cout << "验证登录失败" << endl;
//菜单界面
void Admin::operMenu(){
cout << "===============================欢迎管理员的登录=============================" << 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| 其余键注销登录 |\n";
cout << "\t\t--------------------------------------------\n";
}
//初始化容器
void Admin::initVector(){
vStu.clear();
vTea.clear();
//读取信息 学生,老师
ifstream ifs;
ifs.open(STUDENT_FILE, ios::in);
if (!ifs.is_open()) {
cout << "文件读取失败" << endl;
return;
}
Student s;
while (ifs >> s.m_Id && ifs >> s.m_Name && ifs >> s.m_Pwd) {
vStu.push_back(s);
}
//cout << "当前学生的数量为" << vStu.size() << endl;
ifs.close();
ifs.open(TEACHER_FILE, ios::in);
if (!ifs.is_open()) {
cout << "文件读取失败" << endl;
return;
}
Teacher t;
while (ifs >> t.emp_Id && ifs >> t.m_Name && ifs >> t.m_Pwd) {
vTea.push_back(t);
}
//cout << "当前老师的数量为" << vTea.size() << endl;
ifs.close();
}
在有参构造中调用和初始化
//有参构造
Admin::Admin(string name, string pwd){
this->m_Name = name;
this->m_Pwd = pwd;
this->initVector();
}
/检测重复,参数1:检测学号 学生/教师 参数2:检测类型,教师/学生
bool Admin::checkRepeat(int id, int type){
if (type == 1) {
for (vector<Student>::iterator it = vStu.begin();it != vStu.end();it++) {
if (id == (*it).m_Id) {
return true;
}
}
}
if (type == 2) {
for (vector<Teacher>::iterator it = vTea.begin();it != vTea.end();it++) {
if (id == (*it).emp_Id) {
return true;
}
}
}
return false;
}
在具体的添加账号中调用检查重复和初始化容器的成员函数
//添加账户
void Admin::addPerson(){
string fileName;
string tip;
string errorTip;
ofstream ofs;
int select = 0;
while (true) {
cout << "请输入添加账号的类型" << endl;
cout << "1.添加学生" << endl;
cout << "2.添加老师" << endl;
cout << "请输入你的选择:" << endl;
cin >> select;
if (select == 1) {
fileName = STUDENT_FILE;
tip = "请输入学号:";
errorTip = "你输入的学号已存在";
break;
}
else if (select == 2) {
fileName = TEACHER_FILE;
tip = "请输入你的职工号:";
errorTip = "你输入的职工号已存在";
break;
}
else {
cout << "你的输入有误,请重新输入" << endl;
system("pause");
system("cls");
}
}
ofs.open(fileName, ios::out | ios::app);//以追加的形式写入
int id;//学号或职工号
string name;//姓名,密码
string pwd;//密码
while (true) {
cout << tip << endl;
cin >> id;
if (this->checkRepeat(id, select)) {
cout << errorTip << endl;
}
else {
break;
}
}
cout << "请输入姓名: " << endl;
cin >> name;
cout << "请输入密码: " << endl;
cin >> pwd;
ofs << id << " " << name << " " << pwd << " " << endl;
cout << "添加成功" << endl;
system("pause");
system("cls");
this->initVector();//直接初始化容器,避免再次添加时跳过前一个添加的信息
ofs.close();
}
注意:要在添加成功时,调用initVector()初始化容器,要不然上一个添加的信息,没有写入到vector容器中,会导致继续添加时不被记录,使得可以添加多份相同的账号
查看账户提供查看学生账户和查看老师账户2种,利用for_each()方法展示查看到的数据
void printStudent(Student& s) {
cout << "学号: " << s.m_Id << " 姓名: " << s.m_Name << " 密码: " << s.m_Pwd << endl;
}
void printTeacher(Teacher& t) {
cout << "职工号: " << t.emp_Id << " 姓名: " << t.m_Name << " 密码: " << t.m_Pwd << endl;
}
//查看账户
void Admin::showPerson(){
while (true) {
cout << "请选择查看的内容" << endl;
cout << "1.查看所有学生" << endl;
cout << "2.查看所有老师" << endl;
cout << "请输入你的选择:" << endl;
int select = 0;
cin >> select;
if (select == 1) {
cout << "所有学生信息如下:" << endl;
for_each(vStu.begin(), vStu.end(), printStudent);
break;
}
else if (select == 2) {
cout << "所有的老师信息如下:" << endl;
for_each(vTea.begin(), vTea.end(), printTeacher);
break;
}
else {
cout << "输入错误" << endl;
system("pause");
system("cls");
}
}
system("pause");
system("cls");
}
computerRoom.h
#pragma once
#include
using namespace std;
class ComputerRoom {
public:
int m_ComId;//机房id号
int m_MaxNum; //机房最大容量
};
在Admin.h中添加
//机房容器
vector<ComputerRoom> vCRom;
在Admin.cpp中的构造函数中初始化
//初始化机房信息
ifstream ifs;
ifs.open(COMPUTER_FILE, ios::in);
ComputerRoom cr;
while (ifs >> cr.m_ComId && ifs>>cr.m_MaxNum) {
vCRom.push_back(cr);
}
ifs.close();
//cout << "机房的数量为:" << vCRom.size() << endl;
通过遍历拿到输出机房信息
//查看机房信息
void Admin::showComputer(){
cout << "机房的信息如下" << endl;
for (vector<ComputerRoom>::iterator it = vCRom.begin();it != vCRom.end();it++) {
cout << "机房编号:" << (*it).m_ComId << " 机房最大容量: " << (*it).m_MaxNum << endl;
}
}
清空预约只需要把预约写入的文件的内容删除即可,调用trunc类型
//清空预约记录记录
void Admin::cleanFile(){
ofstream ofs(ORDER_FILE, ios::trunc);
ofs.close();
cout << "清空成功!" << endl;
system("pause");
system("cls");
}
//有参构造(学号、姓名、密码)
Student::Student(int id, string name, string pwd){
//初始化属性
this->m_Id = id;
this->m_Name = name;
this->m_Pwd = pwd;
}
//进入学生子菜单界面
void studentMenu(Identity*& student) {
while (true) {
//调用学生的子菜单
student->operMenu();
Student* stu = (Student*)student;
int select = 0;
cin >> select;//接受用户的选择
if (select == 1)//申请预约
{
stu->applyOrder();
}
else if (select == 2) //查看自身预约
{
stu->showMyOrder();
}
else if (select == 3)//查看所有人预约
{
stu->showAllOrder();
}
else if (select == 4)//取消预约
{
stu->cancelOrder();
}
else {
//注销登录
delete student;
cout << "注销成功" << endl;
system("pause");
system("cls");
return;//退出循环
}
}
}
记得在验证登录时调用此函数(教师的也是需要调用自己的进入子菜单函数)
person = new Student(id, name, pwd);
studentMenu(person);
//菜单界面
void Student::operMenu(){
cout << "================================"<<"欢迎学生代表: "<<this->m_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| 其余键注销登录 |\n";
cout << "\t\t--------------------------------------------\n";
}
在student.h中添加新的成员函数:机房容器
//机房信息
vector<ComputerRoom> vCom;
在学生的有参构造中追加获取机房信息
//获取机房信息
ifstream ifs;
ifs.open(COMPUTER_FILE, ios::in);
ComputerRoom c;
while (ifs >> c.m_ComId && ifs >> c.m_MaxNum) {
vCom.push_back(c);
}
ifs.close();
//申请预约
void Student::applyOrder(){
cout << "机房开放的时间为周一至周五!" << endl;
cout << "请输入预约的时间:" << endl;
cout << "1.周一" << endl;
cout << "2.周二" << endl;
cout << "3.周三" << endl;
cout << "4.周四" << endl;
cout << "5.周五" << endl;
int date = 0;//日期
int interval = 0; // 时间段
int room = 0; // 机房编号
while (true) {
cin >> date;
if (date >= 1 && date <= 5) {
break;
}
cout << "输入有误,请重新输入" << endl;
}
cout << "请输入预约时间段::" << endl;
cout << "1.上午" << endl;
cout << "2.下午" << endl;
while (true) {
cin >> interval;
if (interval >= 1 && interval <= 2) {
break;
}
cout << "输入错误,请重新输入" << endl;
}
cout << "请选择机房" << endl;
for (int i = 0;i < vCom.size();i++) {
cout << vCom[i].m_ComId << "号机房容量为: " << vCom[i].m_MaxNum << endl;
}
while (true) {
cin >> room;
if (room >= 1 && room <= 3) {
break;
}
cout << "输入有误,请重新输入" << endl;
}
cout << "预约成功,审核中" << endl;
ofstream ofs;
ofs.open(ORDER_FILE, ios::app);
ofs << "data:" << date << " ";
ofs << "interval:" << interval << " ";
ofs << "stuId:" << this->m_Id << " ";
ofs << "stuName:" << this->m_Name << " ";
ofs << "roomId:" << room << " ";
ofs << "status:" << 1 << endl;
ofs.close();
system("pause");
system("cls");
}
功能描述:
显示预约记录时,需要从文件中获取到所有的记录,用来显示,创建预约的类来管理记录以及更新
在头文件以及源文件下分别创建orderFile.h和orderFile.cpp文件
orderFile.h
#pragma once
#include
using namespace std;
#include
#include"globalFile.h"
#include
#include
class OrderFile {
public:
//构造函数
OrderFile();
//更新预约记录
void updateOrder();
//记录预约条数
int m_Size;
//记录所有预约信息的容器,key记录条数,value记录具体键值对信息
map<int, map<string, string>> m_orderData;
};
orderFile.cpp
#include"orderFile.h"
//构造函数
OrderFile::OrderFile() {
ifstream ifs;
ifs.open(ORDER_FILE, ios::in);
string date; //日期
string interval; // 时间段
string stuId; //学生编号
string stuName; //学生姓名
string roomId; //预约机房的编号
string status;//预约的状态
this->m_Size = 0; // 记录条数
while (ifs >> date && ifs >> interval && ifs >> stuId &&
ifs >> stuName && ifs >> roomId && ifs >> status) {
string key;
string value;
map<string, string> m;
//date
int pos = date.find(":");
if (pos != -1) {
key = date.substr(0, pos);
value = date.substr(pos + 1, date.size() - pos - 1);
m.insert(make_pair(key, value));
}
//interval
pos = interval.find(":");
if (pos != -1) {
key = interval.substr(0, pos);
value = interval.substr(pos + 1, interval.size() - pos - 1);
m.insert(make_pair(key, value));
}
//stuId
pos = stuId.find(":");
if (pos != -1) {
key = stuId.substr(0, pos);
value = stuId.substr(pos + 1, stuId.size() - pos - 1);
m.insert(make_pair(key, value));
}
//stuName
pos = stuName.find(":");
if (pos != -1) {
key = stuName.substr(0, pos);
value = stuName.substr(pos + 1, stuName.size() - pos - 1);
m.insert(make_pair(key, value));
}
//roomId
pos = roomId.find(":");
if (pos != -1) {
key = roomId.substr(0, pos);
value = roomId.substr(pos + 1, roomId.size() - pos - 1);
m.insert(make_pair(key, value));
}
//status
pos = status.find(":");
if (pos != -1) {
key = status.substr(0, pos);
value = status.substr(pos + 1, status.size() - pos - 1);
m.insert(make_pair(key, value));
}
this->m_orderData.insert(make_pair(this->m_Size, m));
this->m_Size++;
}
ifs.close();
//测试最大map容器
for (map<int, map<string, string>>::iterator it = m_orderData.begin();it != m_orderData.end();it++) {
cout << "条数为: " << it->first << " value= " << endl;
for (map<string, string>::iterator mit = (*it).second.begin();mit != (*it).second.end();mit++) {
cout << "key= " << mit->first << " value= " << mit->second << " ";
}
cout << endl;
}
}
//更新预约记录
void OrderFile::updateOrder() {
if (this->m_Size == 0) {
return;
}
ofstream ofs(ORDER_FILE, ios::out | ios::trunc);
for (int i = 0;i < m_Size;i++) {
ofs << "date:" << this->m_orderData[i]["date"] << " ";
ofs << "interval:" << this->m_orderData[i]["interval"] << " ";
ofs << "stuId:" << this->m_orderData[i]["stuId"] << " ";
ofs << "stuName:" << this->m_orderData[i]["stuName"] << " ";
ofs << "roomId:" << this->m_orderData[i]["roomId"] << " ";
ofs << "status:" << this->m_orderData[i]["status"] << endl;
}
ofs.close();
}
//查看我的预约
void Student::showMyOrder(){
OrderFile of;
if (of.m_Size == 0) {
cout << "无预约记录!" << endl;
system("pause");
system("cls");
return;
}
//
// string转int
// string利用.c_str()转const char *
// 利用atoi( const char *) 转 int
///
for (int i = 0;i < of.m_Size;i++) {
if (this->m_Id == atoi(of.m_orderData[i]["stuId"].c_str()))//通过id号找到自己的预约
{
cout << " 预约日期: 周" << of.m_orderData[i]["date"];
cout << " 时间段: " << (of.m_orderData[i]["interval"] == "1" ? "上午" : "下午");
cout << " 机房号: " << of.m_orderData[i]["roomId"];
string status = "状态: ";
//1.审核中 2.已预约 -1 预约失败 0 取消预约
if (of.m_orderData[i]["status"] == "1") {
status += "审核中";
}
else if (of.m_orderData[i]["status"] == "2") {
status += "预约成功";
}
else if (of.m_orderData[i]["status"] == "-1") {
status += "预约失败,审核未通过";
}
else {
status += "预约已取消";
}
cout << " " << status << endl;
}
}
system("pause");
system("cls");
}
去除掉筛选和添加学号显示姓名显示及可
//查看所有预约
void Student::showAllOrder(){
OrderFile of;
if (of.m_Size == 0) {
cout << "无预约记录!" << endl;
system("pause");
system("cls");
return;
}
for (int i = 0;i < of.m_Size;i++) {
cout << "学号: " << of.m_orderData[i]["stuId"];
cout << " 姓名: " << of.m_orderData[i]["stuName"];
cout << " 预约日期: 周" << of.m_orderData[i]["date"];
cout << " 时间段: " << (of.m_orderData[i]["interval"] == "1" ? "上午" : "下午");
cout << " 机房号: " << of.m_orderData[i]["roomId"];
string status = "状态: ";
//1.审核中 2.已预约 -1 预约失败 0 取消预约
if (of.m_orderData[i]["status"] == "1") {
status += "审核中";
}
else if (of.m_orderData[i]["status"] == "2") {
status += "预约成功";
}
else if (of.m_orderData[i]["status"] == "-1") {
status += "预约失败,审核未通过";
}
else {
status += "预约已取消";
}
cout << " " << status << endl;
}
system("pause");
system("cls");
}
//取消预约
void Student::cancelOrder(){
OrderFile of;
if (of.m_Size == 0) {
cout << "无预约记录!" << endl;
system("pause");
system("cls");
return;
}
cout << "审核中或是预约成功的记录可以取消,请输入取消的记录" << endl;
vector<int> v; // 存放在最大容器的下标编号
int index = 1;
for (int i = 0;i < of.m_Size;i++) {
//先判断是自身学号
if (this->m_Id == atoi(of.m_orderData[i]["stuId"].c_str())) {
//再筛选状态
if (of.m_orderData[i]["status"] == "1" || of.m_orderData[i]["status"] == "2") {
v.push_back(i);
cout << index++ << "、";
cout << " 预约日期: 周" << of.m_orderData[i]["data"];
cout << " 时间段: " << (of.m_orderData[i]["interval"] == "1" ? "上午" : "下午");
cout << " 机房号: " << of.m_orderData[i]["roomId"];
string status = "状态: ";
//1.审核中 2.已预约 -1 预约失败 0 取消预约
if (of.m_orderData[i]["status"] == "1") {
status += "审核中";
}
else if (of.m_orderData[i]["status"] == "2") {
status += "预约成功";
}
cout << " " << status << endl;
}
}
}
cout << "请输入取消的记录,0代表返回" << endl;
int select = 0;
while (true) {
cin >> select;
if (select >= 0 && select <= v.size()) {
if (select == 0) {
break;
}
else {
of.m_orderData[v[select - 1]]["status"] = "0";//将要取消记录的状态值变为0
of.updateOrder();//调用数据更新
cout << "已取消预约" << endl;
break;
}
}
cout << "输入有误,请重新输入" << endl;
}
system("pause");
system("cls");
}
//进入教师子菜单界面
void teacherMenu(Identity*& teacher) {
while (true) {
teacher->operMenu();
Teacher* tea = (Teacher*)teacher;
cout << "请输入您的选择:" << endl;
int select = 0;
cin >> select;
if (select == 1) {//查看所有预约
tea->showAllOrder();
}
else if (select == 2) {//审核预约
tea->examineOrder();
}
else {
delete teacher;
cout << "注销成功" << endl;
system("pause");
system("cls");
return;
}
}
}
//有参构造
Teacher::Teacher(int id, string name, string pwd){
//初始化属性
this->emp_Id = id;
this->m_Name = name;
this->m_Pwd = pwd;
}
//菜单界面
void Teacher::operMenu(){
cout << "================================" << "欢迎老师: " << this->m_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| 其余键注销登录 |\n";
cout << "\t\t--------------------------------------------\n";
}
这个功能和学生的查看所有预约一样,不做代码解释
//审核预约
void Teacher::examineOrder(){
OrderFile of;
if (of.m_Size == 0) {
cout << "无预约记录!" << endl;
system("pause");
system("cls");
return;
}
cout << "待审核的预约记录如下:" << endl;
vector<int> v;
int index = 0;
for (int i = 0;i < of.m_Size;i++) {
//先筛选出需要审核的预约
if (of.m_orderData[i]["status"] == "1") {
v.push_back(i);
cout << ++index << "、";
cout << "需要审核预约的学生学号:" << of.m_orderData[i]["stuId"];
cout << " 姓名: " << of.m_orderData[i]["stuName"];
cout << " 预约日期: 周" << of.m_orderData[i]["data"];
cout << " 时间段: " << (of.m_orderData[i]["interval"] == "1" ? "上午" : "下午");
cout << " 机房号: " << of.m_orderData[i]["roomId"];
string status = "状态: ";
//1.审核中 2.已预约 -1 预约失败 0 取消预约
if (of.m_orderData[i]["status"] == "1") {//这里全是审核中的
status += "审核中";
}
cout << " " << status << endl;
}
}
while (true) {
cout << "请输入审核的预约记录,0代表返回" << endl;
int select = 0;
int ret = 0;
cin >> select;
if (select >= 0 && select <= v.size()) {
if (select == 0) {
break;
}
else {
cout << "请输入审核结果" << endl;
cout << "1.通过" << endl;
cout << "2.不通过" << endl;
cin >> ret;
}
if (ret == 1) {
of.m_orderData[v[select - 1]]["status"] = "2";
}
else {
of.m_orderData[v[select - 1]]["status"] = "-1";
}
of.updateOrder();//更新数据
cout << "审核完毕" << endl;
break;
}
cout << "输入有误,请重新输入" << endl;
}
system("pause");
system("cls");
}