五. 编码实现 我负责的是: 客房信息的录入; 客房信息的删除 客房信息的修改
void AddtheGuestroom(tList
cGuestroom tempGuestroom; //定义临时客房 cout<<\下面开始添加客房信息\\n\ cout<<\请输入入住的客房编号:\
cin>>tempGuestroom.ID; //读入客房编号
cout<<\请输入客房类型:(single,standard,junior suite,deluxe suite)\
cin>>tempGuestroom.Type; //读入客房类型 cout<<\请输入客人定房日期:\
cin>>tempGuestroom.Book; //读入定房日期 cout<<\请输入客房价格:\
cin>>tempGuestroom.Price; //读入价格
6
cout<<\请输入客房的主要内容:(computer,bathroom,air conditioner)\
cin>>tempGuestroom.Function; //读入主要内容 cout<<\请输入客房入住有效期:\
cin>>tempGuestroom.StayTime; //读入入住有效期 tempGuestroom.flag=true; tListGue->Insert(tempGuestroom); cout<<\添加成功!\\n\
system(\:停顿,终止 system(\}
void SaveData(tList
int i=0;
ofstream ofile(\//创建一个输入文件流对象 if (!ofile) {
7
cerr << \保存时打开文件出错!\ }
cNode
//内存中读取数据,存到外盘 if(p->data.flag) {
ofile<<\
ofile<<(p->data).ID<<\ ofile<<(p->data).Type<<\ ofile<<(p->data).Book<<\ ofile<<(p->data).Price<<\ ofile<<(p->data).Function<<\ ofile<<(p->data).StayTime<<\ }
p=p->next; }
cout<<\保存数据成功!\\n\ ofile.close();
从8
system(\ system(\ return; }
void ModifytheGuestroom(tList
char id[BUFSIZE];
cout<<\请输入你要查找的客房编号:\
cin>>id; //读取客房编号 bool flag=false; cNode
if(strcmp(p->data.ID,id)==0 && p->data.flag) {
flag=true;
9
break; }
p=p->next; }
if(flag==true) {//显示屏幕
cout<<\找到了,该客房的原始信息是:\\n\
cout<<\客房编号:\客房类型:\
定
房
日
期:\价格:\ cout<<\容
客
房
的
入主住
要有
内效
:\
期:\
cout<<\下面开始修改该客房的信息:\\n\
cGuestroom tempGuestroom; //定义临时客房
cout<<\请输入客房的客房编号:\
cin>>tempGuestroom.ID; //读入客房编号
cout<<\
请输入客房的客房类型
:
(single,standard,junior suite,deluxe suite)\
10
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库酒店管理系统软件系统(2)在线全文阅读。
相关推荐: