由于疫情的原因,需要登记各商铺的人员访问情况,请设计与实现一个人员登记系统。基本要求如下:
1、建立商户信息,如商户编号,商户信息,商户地点,营业时间等,用文件实现商户的信息管理(增删改查);
2、建立客户信息,如客户身份证号,姓名,电话,健康状态(正常、确证、密切接触者、无症状)的信息管理(增删改查);
3、建立客户访问商户信息,如进入时间,离开时间,身份证号,商户编号;
4、所有信息用文件管理;
5、 在三个文件中录入相应的测试数据(每个文件不少于6条记录)并实现下列高级查询:
1)按日统计所有商户的访问人数;
2)按健康状态统计客户人数;
3)给定某个无症状客户,查询与其同时间段出现同一个商户的所有人员名单;
#include<iostream>
#include<cstring>
#include<fstream>
#include<iomanip>
#include<stdlib.h>
using namespace std;
const int mm = 123456;
class Client//客户类
{
public:
Client(char* s = "null", char* n = "null", char* p = "null", int j = 0)//构造函数
{
strcpy(this->ID_number, s);
strcpy(this->name, n);
strcpy(this->phone, p);
this->health = j;
}
friend class Manage;//友元类
private:
char ID_number[46];//身份证号
char name[10];//客户名字
char phone[20];//客户电话
int health;//客户健康状态
Client* next;//定义指向类Client的指针变量next
};
class Vendor//商户类
{
public:
Vendor(int I = 0, char* x = "null", char* d = "null", char* s = "null")//构造函数
{
this->ID = I;
strcpy(this->information, x);
strcpy(this->address, d);
strcpy(this->business_hours, s);
}
friend class Manage;//友元类
private:
int ID;//商户编号
char information[46];//商户信息
char address[46];//商户地址
char business_hours[46];//营业时间
Vendor* next;//指向类Vendor的指针next
};
class Time //时间类
{
public: //公有函数成员
Time(int h = 0, int m = 0)//构造函数
{
hour = h;
minute = m;
}
friend istream& operator >> (istream& input, Time& a);
friend ostream& operator << (ostream& output, Time& a);
friend int operator >(Time& a, Time& b); //重载比较大于号函数
friend int operator <(Time& a, Time& b); //重载比较小于号函数
private: //私有数据成员
int hour;//小时
int minute;//分钟
friend class Manage;
friend class Visit;
};
class Visit//客户访问商户类
{
private:
char time[46];//访问日期
Time intime;//进入时间
Time outtime;//出来时间
char ID_number[46];//客户身份证号码
int ID;//商户编号
Visit* next;//指向类Visit的指针next
friend class Manage;//友元类
friend class Vendor;
friend class Client;
public:
Visit(char* t = "null", char* n = "null", int d = 0, Time i = 0, Time o = 0)//构造函数
{
this->ID = d;
strcpy(this->time, t);
strcpy(this->ID_number, n);
intime = i;
outtime = o;
}
};
int operator >(Time& a, Time& b)//重载大于号运算符
{
int s;
s = (a.hour * 60 + a.minute) - (b.hour * 60 + b.minute);
if (s > 0)return 1;
else return 0;
}
int operator <(Time& a, Time& b)//重载小于号运算符
{
int s;
s = (a.hour * 60 + a.minute) - (b.hour * 60 - b.minute);
if (s < 0)return 1;
else return 0;
}
istream& operator >> (istream& input, Time& a) //重载流插入运算符
{
char bb;
input >> a.hour >> bb >> a.minute;
return input;
}
ostream& operator << (ostream& output, Time& a)//重载流提取运算符
{
output << a.hour << ":" << a.minute;
return output;
}
class Manage//管理类
{
private:
Vendor* PP;//指向商户类的指针
Client* pk;//指向客户类的指针
Visit* pv;//指向客户访问商户的指针
public:
void addV();//增加商户
void showV();//查看商户
void deleteV();//删除商户
void replaceV();//修改商户
void showwV();//遍历商户
void saveV();//保存客户信息到文件
void addC();//增加客户
void showC();//查看客户
void deleteC();//删除客户
void replaceC();//修改客户
void showwC();//遍历客户
void saveC();//保存商户信息文件
void addvc();//增加客户访问商户
void ahowwS();//遍历客户访问商户
void saveS();//保存客户访问商户信息到文件
void fvv();//按日统计各商户的访问人数
void hak();//按健康状态统计客户人数
void chaxun();//给出某个无症者,查询和他在同一时间段出现在同一商户的人员名单
Manage()//构造函数
{
PP = 0;
pk = 0;
pv = 0;
}
~Manage()//析构函数
{
Vendor* p;//析构商户类
p = PP;
while (p)
{
p = p->next;
delete PP;
}
PP = 0;
Client* pr;//析构客户类
pr = pk;
while (pr)
{
pr = pr->next;
delete pk;
pk = pr;
}
pk = 0;
Visit* ps;//析构客户访问商户类
ps = pv;
while (pr)
{
ps = ps->next;
delete pv;
pv = ps;
}
pv = 0;
}
};
void Manage::fvv()//按日统计各商户的访问人数
{
char a[100][46];//保存日期
int id[100][100] = { 0 };//保存商户编号
int num[100][100] = { 0 };//累加访问人数
Visit* visit = NULL;//头指针
Visit* s, * ss;
ifstream input("Customer Visit Vendor.txt", ios::binary);//打开客户访问商户统计文件
if (!input.is_open())
{
cout << "Error opening file";
exit(1);
}
Visit* s2;
while (!input.eof())//读取文件
{
if (visit == NULL)
s2 = s = visit = new Visit;
else
{
s2 = s;
s->next = new Visit;
s = s->next;
}
input.read((char*)s, sizeof(*s));
s->next = NULL;
if (input.eof())
{
free(s2->next);
s2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
s->next = NULL;
s = visit;
if (s != NULL)
{
int i = 0;
strcpy(a[0],s->time);
while (s)//便利链表节点
{
int m = 0;
for (int j=0; j < i + 1; j++)
{
if (strcmp(a[j], s->time) == 0)
m = 1;
}
if (m)
{
s = s->next;
}
else
{
i++;
strcpy(a[i], s->time);
s = s->next;
}
}
cout << " |----------------------------------------------------------------|" << endl;
for (int j = 0; j < i+1 ; j++)
{
cout << " 日期:" << a[j] << endl;
ss=visit;
int n = 0;
id[j][0]=ss->ID;
while (ss)//寻找同一日期下的商户
{
if (strcmp(a[j], ss->time) == 0)
{
int m = 1;
int k;
for (k=0; k < i + 1; k++)
{
if (id[j][k] == ss->ID)
{
m = 0;
break;
}
}
if (m)
{
id[j][n] = ss->ID;
num[j][n]++;
n++;
ss = ss->next;
}
else
{
num[j][k]++;
ss = ss->next;
}
}
else
ss=ss->next;
}
for (int z = 0; z < n + 1; z++)
{
cout << " Ventor ID:" << id[j][z] << " Number Of Visitors Of The Day:" << num[j][z] << endl;
}
}
}
else
{
cout << "No Information!" << endl;
}
input.close();
cout << " |----------------------------------------------------------------|" << endl;
return;
}
void Manage::addvc()//增加商户访问客户数据
{
char time[46];
Time intime;
Time outtime;
char ID_number[46];
int id;
cout << " |----------Enter Customer Cccess Cerchant Information------------|" << endl;
cout << " Date Of The Day:";
cin >> time;
cout << " Enter Access Customer ID Number:";
cin >> ID_number;
cout << " Enter Customer Access Merchant ID:";
cin >> id;
cout << " In Time:";
cin >> intime;
cout << " Out Time:";
cin >> outtime;
cout << " |----------Enter Successfully!---------------------------------------|" << endl;
Visit* p;//新节点指针
p = new Visit(time, ID_number, id, intime, outtime);
p->next = 0;
if (pv)//如果存在
{
Visit* p2;
p2 = pv;
while (p2->next)
{
p2 = p2->next;//查找尾节点
}
p2->next = p;//连接
}
else//如果不存在节点(没有商户)
{
pv = p;//连接
}
ofstream oks("Customer Visit Vendor.txt", ios::binary | ios::app);
if (oks.is_open())
{
oks.write((char*)p, sizeof(*p));
p = p->next;
}
return;
}
void Manage::ahowwS()//遍历客户访问商户链表
{
Visit* visit = NULL;//头指针
Visit* s, * ss;
ifstream input("Customer Visit Vendor.txt", ios::binary);//打开客户统计文件
if (!input.is_open())
{
cout << "Error opening file";
exit(1);
}
Visit* s2;
while (!input.eof())//读取文件
{
if (visit == NULL)
s2 = s = visit = new Visit;
else
{
s2 = s;
s->next = new Visit;
s = s->next;
}
input.read((char*)s, sizeof(*s));
s->next = NULL;
if (input.eof())
{
free(s2->next);
s2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
s->next = NULL;
s = visit;
cout << setiosflags(ios::left) << setw(20) << "Data" << setiosflags(ios::left) << setw(20) << "ID Number"
<< setiosflags(ios::left) << setw(8) << "Vendor ID" << setiosflags(ios::left) << setw(10) << "In time"
<< setiosflags(ios::left) << setw(10) << "Out time " << endl;
while (s)
{
cout << setiosflags(ios::left) << setw(20) << s->time << setiosflags(ios::left) << setw(20)
<< setiosflags(ios::left) << s->ID_number << setiosflags(ios::left) << setw(8) << s->ID << setiosflags(ios::left)
<< "" << s->intime << setiosflags(ios::left) << " " << s->outtime << endl;
s = s->next;
}
}
void Manage::hak()//按健康状态统计人数
{
Client* client = NULL;
Client* c;
ifstream in("Customer Statistics.txt", ios::binary);//打开客户统计文件
if (!in.is_open())
{
cout << "Error opening file";
exit(1);
}
Client* c2;
while (!in.eof())
{
if (client == NULL)
c2 = c = client = new Client;
else
{
c2 = c;
c->next = new Client;
c = c->next;
}
in.read((char*)c, sizeof(*c));
c->next = NULL;
if (in.eof())
{
free(c2->next);
c2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
c->next = NULL;
c = client;
int a, b, C, d;//统计各个健康状态的人数变量
a = b = C = d = 0;
while (c)
{
switch (c->health)
{
case 1:a++; break;
case 2:b++; break;
case 3:C++; break;
case 4:d++; break;
}
c = c->next;
}
cout << "|------Number of people by health status-------|" << endl;
<< "| 正常:" << a << " 人 |" << endl;
<< "| 确诊:" << b << " 人 |" << endl;
<< "| 密切接触:" << C << " 人 |" << endl;
<< "| 无症状:" << d << " 人 |" << endl;
<< "|----------------------------------------------|" << endl;
}
void Manage::chaxun()//给定某个无症者,查询其同一时间段出现在同一商户的人员名单
{
char ID_numbe[46];
cout << "Enter the ID card number of the patient without symptoms:";
cin >> ID_numbe;
char sfzh[100][100][46];//保存身份证号码
Time intime[100];//保存进入时间
Time outtime[100];//保存离开时间
int id[100];//保存商户编号
Visit* visit = NULL;//头指针
Visit* v, * vv;
ifstream input("Customer Visit Vendor.txt", ios::binary);//打开客户访问商户统计文件
if (!input.is_open())
{
cout << "Error opening file";
exit(1);
}
Visit* v2;
while (!input.eof())//读取文件
{
if (visit == NULL)
v2 = v = visit = new Visit;
else
{
v2 = v;
v->next = new Visit;
v = v->next;
}
input.read((char*)v, sizeof(*v));//将读取的文件保存到链表当中
v->next = NULL;
if (input.eof())
{
free(v2->next);
v2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
v->next = NULL;
v = visit;
input.close();//关闭文件
if (v != NULL)
{
int i = 0;//记录商户编号个数
int l[100]={0};//记录每个商户下的客户人数
id[0] = v->ID;
intime[0] = v->intime;
while (v)//便利链表节点
{
if (strcmp(ID_numbe, v->ID_number) == 0)//寻找与输入的身份证号相同的人
{
id[i] = v->ID;//保存出现过的商户编号
intime[i] = v->intime;//保存出现过的进入商户时间
outtime[i] = v->outtime;//保存离开商户时间
i++;
}
v = v->next;
}
for (int j = 0; j < i + 1; j++)
{
vv = visit;
while (vv)
{
if (vv->ID == id[j] && intime[j] < vv->intime && outtime[j] > vv->intime)//寻找出现在同一时间段同一商户的人
{
strcpy(sfzh[j][l[j]], vv->ID_number);//保存寻找到的客户身份证号码
l[j]++;
}
vv = vv->next;
}
}
Client* client = NULL;
Client* c;
ifstream inl("Customer Statistics.txt", ios::binary);//打开客户统计文件
if (!inl.is_open())
{
cout << "Error opening file";
exit(1);
}
Client* c2;
while (!inl.eof())
{
if (client == NULL)
c2 = c = client = new Client;
else
{
c2 = c;
c->next = new Client;
c = c->next;
}
inl.read((char*)c, sizeof(*c));//读取文件到链表当中
c->next = NULL;
if (inl.eof())
{
free(c2->next);
c2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
c->next = NULL;
c = client;
inl.close();//关闭文件
cout << " |----------------------------------------------------------------|" << endl;
for (int n = 0; n < i ; n++)//输出存储的商户编号
{
cout << " Vendor ID:" << id[n] << "\n Shops and asymptomatic patients at the same time there are:" << endl;
cout << " " << setiosflags(ios::left) << setw(10) << "Name" << setiosflags(ios::left) << setw(30) << "ID Number"
<< setiosflags(ios::left) << setw(15) << "Phone" << setiosflags(ios::left) << setw(10) << "Health" << endl;
while (c)
{
for (int m = 0; m < l[n]; m++)//输出查找到的客户名单
{
if (strcmp(sfzh[n][m], c->ID_number) == 0)
{
cout << " " << setiosflags(ios::left) << setw(10) << c->name << setiosflags(ios::left) << setw(30) << c->ID_number
<< setiosflags(ios::left) << setw(15) << c->phone << setiosflags(ios::left);
switch (c->health)
{
case 1:cout << "正常" << endl; break;
case 2:cout << "确诊" << endl; break;
case 3:cout << "密切接触" << endl; break;
case 4:cout << "无症者" << endl; break;
}
}
}
c = c->next;
}
}
cout << " |----------------------------------------------------------------|" << endl;
}
else
{
cout << "Not Found!" << endl;
}
}
void Manage::addC()//增加客户
{
char ID_number[46];
char name[10];
char phone[20];
int health;
Client* t;//新节点指针
cout << " |----------Enter Customer Cnformation----------------------------|" << endl;
cout << " Name:";
cin >> name;
cout << " ID Number:";
cin >> ID_number;
cout << " Phone:";
cin >> phone;
cout << " Health(正常输入1、确证输入2、密切接触输入3、无症者输入4):";
cin >> health;
cout << " |----------Successfully Input Customer Information---------------|" << endl;
t = new Client(ID_number, name, phone, health);
t->next = 0;
if (pk)//如果存在
{
Client* t2;
t2 = pk;
while (t2->next)
{
t2 = t2->next;//查找尾节点
}
t2->next = t;//连接
}
else//如果不存在节点(没有商户)
{
pk = t;//连接
}
ofstream okh("Customer Statistics.txt", ios::binary | ios::app);
if (okh.is_open())
{
okh.write((char*)t, sizeof(*t));
t = t->next;
}
okh.close();
return;
}
void Manage::showwC()//遍历客户链表
{
Client* client = NULL;
Client* c;
ifstream inl("Customer Statistics.txt", ios::binary);//打开客户统计文件
if (!inl.is_open())
{
cout << "Error opening file";
exit(1);
}
Client* c2;
while (!inl.eof())
{
if (client == NULL)
c2 = c = client = new Client;
else
{
c2 = c;
c->next = new Client;
c = c->next;
}
inl.read((char*)c, sizeof(*c));//读取文件到链表当中
c->next = NULL;
if (inl.eof())
{
free(c2->next);
c2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
c->next = NULL;
c = client;
inl.close();//关闭文件
cout << setiosflags(ios::left) << setw(10) << "Name" << setiosflags(ios::left) << setw(30) << "ID Number"
<< setiosflags(ios::left) << setw(15) << "Phone" << setiosflags(ios::left) << setw(10) << "Health" << endl;
while (c)
{
cout << setiosflags(ios::left) << setw(10) << c->name << setiosflags(ios::left) << setw(25)
<< setiosflags(ios::left) << c->ID_number << setiosflags(ios::left) << setw(15) << c->phone;
switch (c->health)
{
case 1:cout << setiosflags(ios::left) << setw(10) << "正常" << endl; break;
case 2:cout << setiosflags(ios::left) << setw(10) << "确诊" << endl; break;
case 3:cout << setiosflags(ios::left) << setw(10) << "密切接触" << endl; break;
case 4:cout << setiosflags(ios::left) << setw(10) << "无症者" << endl; break;
}
c = c->next;
}
}
void Manage::deleteC()//删除客户
{
char sfzh[46];
cout << " |---------------Delete Customer----------------------------|" << endl;
cout << " Id Number:";
cin >> sfzh;
//查找删除节点
Client* p1, * p2;
p1 = pk;
if (p1 == NULL)
{
cout << "No Customer Found!" << endl;
return;
}
if (strcmp(p1->ID_number, sfzh) == 0)
{
pk = p1->next;
delete p1;
cout << "Found And Delete!" << endl;
return;
}
else
{
while (strcmp(p1->ID_number, sfzh) != 0 && p1->next != NULL)
{
p2 = p1;
p1 = p1->next;
}
if (p1->ID_number == sfzh)
{
p2->next = p1->next;
delete p1;
cout << "Found And Delete!" << endl;
return;
}
}
}
void Manage::replaceC()//修改客户
{
char sfzh[46];
cout << " |---------------Modify Customer Information----------------------|" << endl;
cout << " ID number:";
cin >> sfzh;
//查找修改的节点
Client* pa, * pb;
pa = pk;
while (pa)
{
if (strcmp(pa->ID_number, sfzh) == 0)
{
cout << " |---------------Enter Customer Information-----------------------|" << endl;
cout << " Name:";
cin >> pa->name;
cout << " ID Number:";
cin >> pa->ID_number;
cout << " Phone:";
cin >> pa->phone;
cout << " Health(正常输入1、确证输入2、密切接触输入3、无症者输入4):";
cin >> pa->health;
cout << " |-------------------Modify Success!------------------------------|" << endl;
ofstream okh("Customer Statistics.txt", ios::binary | ios::app);
if (okh.is_open())
{
okh.write((char*)pa, sizeof(*pa));
pa = pa->next;
}
okh.close();
return;
}
else
{
pb = pa;
pa = pa->next;
}
}
cout << "No Customer Found!" << endl;
return;
}
void Manage::showC()//查找客户信息
{
char sfzh[46];
cout << " |-------------------View Customer Information---------------------|" << endl;
cout << " ID Number:";
cin >> sfzh;
Client* t1, * t2;
t1 = pk;
while (t1)//查找节点
{
cout << "cha" << endl;
if (strcmp(t1->ID_number, sfzh) == 0)
{
cout << " Name:" << t1->name << endl;
cout << " ID number:" << t1->ID_number << endl;
cout << " Phone:" << t1->phone << endl;
switch (t1->health)
{
case 1:cout << " Health(正常、确诊、密切接触、无症者):" << "正常" << endl; break;
case 2:cout << " Health(正常、确诊、密切接触、无症者):" << "确诊" << endl; break;
case 3:cout << " Health(正常、确诊、密切接触、无症者):" << "密切接触" << endl; break;
case 4:cout << " Health(正常、确诊、密切接触、无症者):" << "无症者" << endl; break;
}
cout << " |----------------------------------------------------------------|" << endl;
return;
}
else
{
t2 = t1;
t1 = t1->next;
}
}
cout << "No Found" << endl;
}
void Manage::addV()//增加商户
{
int ID;
char information[46];
char address[46];
char business_hours[46];
Vendor* p;//新节点指针
cout << " |-----------------------Add New Merchant-----------------------------|" << endl;
cout << " ID:";
cin >> ID;
cout << " Information:";
cin >> information;
cout << " Address:";
cin >> address;
cout << " Business hours:";
cin >> business_hours;
cout << " |----------------------------Enter Success!--------------------------|" << endl;
p = new Vendor(ID, information, address, business_hours);
p->next = 0;
if (PP)//如果存在
{
Vendor* p2;
p2 = PP;
while (p2->next)
{
p2 = p2->next;//查找尾节点
}
p2->next = p;//连接
}
else//如果不存在节点(没有商户)
{
PP = p;//连接
}
ofstream osh("Merchant Statistics.txt", ios::binary | ios::app);
if (osh.is_open())
{
osh.write((char*)p, sizeof(*PP));
p = p->next;
}
osh.close();
return;
}
void Manage::showwV()// 便利商户链表
{
Vendor* vendor = NULL;
Vendor* g;
ifstream inl("Merchant Statistics.txt", ios::binary);//打开商户统计文件
if (!inl.is_open())
{
cout << "Error opening file";
exit(1);
}
Vendor* g2;
while (!inl.eof())
{
if (vendor == NULL)
g2 = g = vendor = new Vendor;
else
{
g2 = g;
g->next = new Vendor;
g = g->next;
}
inl.read((char*)g, sizeof(*g));//读取文件到链表当中
g->next = NULL;
if (inl.eof())
{
free(g2->next);
g2->next = NULL;
break;
}//目的是清除最后一次重复,这个操作和\n以及eof有关
}
g->next = NULL;
g = vendor;
inl.close();//关闭文件
cout << setiosflags(ios::left) << setw(6) << "ID" << setiosflags(ios::left)
<< setw(20) << "address" << setiosflags(ios::left) << setw(20) << "information"
<< setiosflags(ios::left) << setw(20) << "business hours" << endl;
while (g)
{
cout << setiosflags(ios::left) << setw(6) << g->ID << setiosflags(ios::left) << setw(20) <<
g->address << setiosflags(ios::left) << setw(20) << g->information << setiosflags(ios::left) << setw(20) << g->business_hours << endl;
g = g->next;
}
}
void Manage::deleteV()//删除商户
{
int id;
cout << " |---------------------Delete Vendor----------------------------------|" << endl;
cout << "ID:";
cin >> id;
//查找删除节点
Vendor* p1, * p2;
p1 = PP;
if (p1 == NULL)
{
cout << "The Vendor Was Not Found" << endl;
return;
}
if (p1->ID == id)
{
PP = p1->next;
delete p1;
cout << " |-------------------Found And Delete!-------------------------------|" << endl;
return;
}
else
{
while (p1->ID != id && p1->next != NULL)
{
p2 = p1;
p1 = p1->next;
}
if (p1->ID == id)
{
p2->next = p1->next;
delete p1;
cout << " |-------------------Found And Delete!----------------------------|" << endl;
return;
}
}
}
void Manage::replaceV()//修改商户
{
int id;
cout << " |----------------------Modify Vendor Information---------------------|" << endl;
cout << " Vendor ID:";
cin >> id;
//查找修改的节点
Vendor* p1, * p2;
p1 = PP;
while (p1)
{
if (p1->ID == id)
break;
else
{
p2 = p1;
p1 = p1->next;
}
}
//修改节点
if (p1 != NULL)
{
cout << " ID:";
cin >> p1->ID;
cout << " Information:";
cin >> p1->information;
cout << " Address:";
cin >> p1->address;
cout << " Business Hours:";
cin >> p1->business_hours;
cout << " |----------------------Modify Success!--------------------------|" << endl;
ofstream osh("Merchant Statistics.txt", ios::binary | ios::app);
if (osh.is_open())
{
osh.write((char*)p1, sizeof(Vendor));
osh.close();
}
return;
}
else
{
cout << "The Vendor Was Not Found" << endl;
return;
}
}
void Manage::showV()//查看商户信息
{
int id;
cout << " |----------------------View Vendor Information-----------------------|" << endl;
cout << " Vendor ID:";
cin >> id;
Vendor* p1, * p2;
p1 = PP;
while (p1)//查找节点
{
if (p1->ID == id)
break;
else
{
p2 = p1;
p1 = p1->next;
}
}
if (p1 != NULL)
{
cout << " ID:" << p1->ID << endl;
cout << " Address:" << p1->address << endl;
cout << " Information:" << p1->information << endl;
cout << " Business Hours:" << p1->business_hours << endl;
cout << endl;
cout << " |--------------------------------------------------------------------|" << endl;
}
else
{
cout << "The Vendr Was Not Found!" << endl;
}
}
int main()//主函数
{
int b;
cout << " |--------------------------------------------------------------------|" << endl;
cout << " | Places Enter Your System Password(Three Chances!) |" << endl;
for (int i = 0; i < 3; i++)
{
cout << " ";
cin >> b;
if (b == mm)
{
cout << " |---------------Input Correctly,Enter The System---------------------|" << endl;
break;
}
cout << " | input error ! |" << endl;
if (i == 2)
{
cout << " |-------------------Three Times,Log Ou-------------------------------|" << endl;
return 0;
}
cout << " | Have " << 3 - (i + 1) << " Chances! |" << endl;
}
cout << " |-----------Welcome To The People Trail Management System------------|" << endl;
int a;
do
{
cout << " | 1~~Add The Merchants |" << endl;
cout << " | 2~~Add The Client |" << endl;
cout << " | 3~~Client visit Merchants |" << endl;
cout << " | Other Characters~~Out System |" << endl;
cout << " |--------------------------------------------------------------------|" << endl;
cout << "Places Input:";
cin >> a;
if (a == 1)
{
Manage A;
int c;
do
{
cout << " |--------------------------------------------------------------------|" << endl;
cout << " | 1~~Add Vendor |" << endl;
cout << " | 2~~View Vendor |" << endl;
cout << " | 3~~Delete Vendor |" << endl;
cout << " | 4~~Modify Vendor |" << endl;
cout << " | 5~~Vendor List |" << endl;
cout << " | Other Characters~~Out Vendor Interface |" << endl;
cout << " |--------------------------------------------------------------------|" << endl;
cout << "\nPlaces Input(1-4):";
cin >> c;
switch (c)
{
case 1: A.addV(); break;
case 2: A.showV(); break;
case 3: A.deleteV(); break;
case 4: A.replaceV(); break;
case 5: A.showwV(); break;
}
} while (c == 1 || c == 2 || c == 3 || c == 4 || c == 5);
}
if (a == 2)
{
int c;
Manage A;
do
{
cout << " |--------------------------------------------------------------------|" << endl;
cout << " | 1~~Add Client |" << endl;
cout << " | 2~~View Client |" << endl;
cout << " | 3~~Delete Client |" << endl;
cout << " | 4~~Modify Client |" << endl;
cout << " | 5~~Client list |" << endl;
cout << " | Other Characters~~Out Client Interface |" << endl;
cout << " |--------------------------------------------------------------------|" << endl;
cout << "\nPlaces Input(1-4):";
cin >> c;
switch (c)
{
case 1: A.addC(); break;
case 2: A.showC(); break;
case 3: A.deleteC(); break;
case 4: A.replaceC(); break;
case 5: A.showwC(); break;
}
} while (c == 1 || c == 2 || c == 3 || c == 4 || c == 5);
}
if (a == 3)
{
int c;
Manage C;
do
{
cout << " |--------------------------------------------------------------------|" << endl;
cout << " | 1~~Add Customer Cccess Merchant Information |" << endl;
cout << " | 2~~Count The Number Of Visitors Of All Merchants By Day|" << endl;
cout << " | 3~~Customer Visits By Health |" << endl;
cout << " | 4~~Query The List Of Persons Who Have No Symptoms In |" << endl;
cout << " | The Same Time Period Of A Merchant |" << endl;
cout << " | 5~~Customer Access Merchant List |" << endl;
cout << " | Other Characters~~Out Client Interface |" << endl;
cout << " |--------------------------------------------------------------------|" << endl;
cout << "\nPlaces Input(1-4):";
cin >> c;
switch (c)
{
case 1: C.addvc(); break;
case 2: C.fvv(); break;
case 3: C.hak(); break;
case 4: C.chaxun(); break;
case 5: C.ahowwS(); break;
}
} while (c == 1 || c == 2 || c == 3 || c == 4 || c == 5);
}
} while (a == 1 || a == 2 || a == 3);
cout << "Welcome To The People Trail Management System Next Time!" << endl;
return 0;
}