1、/*(1)登录管理模块:主要实现登录身份的管理、密码管理。(2)旅店信息管理模块:旅店信息的增、删、改、查。(3)度假村信息管理模块:度假村信息的增、删、改、查。(4)预订模块:实现旅店、度假村的预订功能。(5)统计功能:能按多个关键字进行信息统计分析。(6)程序运行时系统中系统信息数据不少于 10 条。C+实现,用文件操作*/登录管理模块:主要实现登录身份的管理、密码管理#include #include #include #include using namespace std;class Logoprivate:string name;string password;public:int
2、 in(); /接受用户登录请求,决定是否允许登入void reg(); /用户注册void print(); /用户登录界面提示;int Logo:in()string n,p;int i=0,j=0; /j 值表示是否存在此用户coutn;coutp;ifstream input;input.open (“logoinfo.txt“);while(!input.eof ()inputnamepassword;if(name=nif(n=name)j=1;input.close ();if(j=0)coutname;coutpassword;while(password.size ()16)
3、coutpassword;outputhsize;input.close ();ifstream in(“hotelinfo.txt“);for(int i=1;ihidhnamehtelhprice;couthsize;isize.close(); /对文件 hsize.txt 操作,读出旅店的信息条数;fstream inout;inout.open (“hotelinfo.txt“,ios:out|ios:app);couthid;couthname;couthtel;couthprice;inouthsize;isize.close(); /对文件 hsize.txt 操作,读出旅店的
4、信息条数;coutisname;Hotel *a=new Hotelhsize;int i=0,flag=0;ifstream input;input.open (“hotelinfo.txt“,ios:in);while(!input.eof ()inputhidhnamehtelhprice;if(hname=isname)flag+; /flag 记录要删除旅店的个数continue;elseai.set (hid,hname,htel,hprice);i+;input.close();ofstream output;output.open(“hotelinfo.txt“,ios:out
5、);for(i=0;iname;inout.open (“hotelinfo.txt“,ios:in);while(!inout.eof ()inouthidhnamehtelhprice;if(hname=name)coutvsize;input.close ();ifstream in(“vacation.txt“);for(int i=1;ividvnamevtelvprice;coutvsize;isize.close(); /对文件 vsize.txt 操作,读出度假村的信息条数;fstream inout;inout.open (“vacation.txt“,ios:out|ios
6、:app);coutvid;coutvname;coutvtel;coutvprice;inoutvsize;isize.close(); /对文件 vsize.txt 操作,读出度假村的信息条数;coutisname;Vacation *a=new Vacationvsize;int i=0,flag=0;ifstream input;input.open (“vacation.txt“,ios:in);while(!input.eof ()inputvidvnamevtelvprice;if(vname=isname)flag+; /flag 记录要删除度假村的个数continue;els
7、eai.set (vid,vname,vtel,vprice);i+;input.close();ofstream output;output.open(“vacation.txt“,ios:out);for(i=0;iname;inout.open (“vacation.txt“,ios:in);while(!inout.eof ()inoutvidvnamevtelvprice;if(vname=name)couti;switch(i)case 1:Hotel:select ();coutn;if(n=Y)coutname;couttel;couthid;coutname1;couthda
8、ta;Book:printh ();coutn;if(n=Y)coutname;couttel;coutvid;coutname1;coutvdata;Book:printv ();coutsize;input.close ();coutsize;input.close ();coutflag;fstream input;switch(flag)case 1:ifstream in(“hsize.txt“);insize1;in.close ();input.open (“hotelinfo.txt“,ios:in);coutmin;coutmax;for(int i=1;itidtnamet
9、teltprice;if(tprice=min)in.close ();input.open (“vacation.txt“,ios:in);coutmin;coutmax;for(int i=1;itidtnametteltprice;if(tprice=min)size=0;if(flag=1)coutname;coutdata;fstream input;input.open (“hbook.txt“,ios:in);doinputtnametteltidtname1tdata;if(tname1=namewhile(!input);input.close ();coutname;cou
10、tdata;fstream input;input.open (“vbook.txt“,ios:in);doinputtnametteltidtname1tdata;if(tname1=namewhile(!input);input.close ();coutflag1;if(flag1=1)flag2=customer.in (); /用户登录while(flag2=0)couti;if(i=3)return 0;flag2=customer.in ();else if(flag1=2)customer.reg (); /新用户注册coutflag2;if(flag2=2)return 0;
11、else coutflag3;switch(flag3)case 1:system(“cls“);coutflag4;if(flag4=1)Hotel H;H.select ();else if(flag4=2)Vacation V;V.select ();else if(flag4=3)int t;coutt;if(t=1)Hotel H1;H1.show(); /显示旅店所有信息else if(t=2)Vacation V1;V1.show(); /显示度假村所有信息else coutflag5;coutflag6;if(flag5=1)Hotel H1;if(flag6=1)H1.add ();else if (flag6=2)H1.alter ();else if(flag6=3)H1.del ();else coutflag7;switch(flag7)case 1:T.hsum ();break;case 2:T.vsum ();break;case 3:T.pricesum ();break;case 4:T.bsum ();break;default: coutk;if(k=Y)system(“cls“);goto found;return 0;