-
大小: 2.69MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-09-12
- 語(yǔ)言: C/C++
- 標(biāo)簽: C++??酒店??源代碼??管理系統(tǒng)??
資源簡(jiǎn)介
1.添加酒店資料
2.刪除酒店資料
3.增加訂單
4.取消訂單
5.查找城市酒店
6.瀏覽所有酒店
7.瀏覽所有訂單
8.退出酒店系統(tǒng)
酒店資料: 酒店編號(hào)(自動(dòng)生成),酒店名稱,所在城市,總房數(shù),普通房數(shù),普通空房數(shù),普通房?jī)r(jià),
高級(jí)房數(shù),高級(jí)空房數(shù),高級(jí)房?jī)r(jià)
訂單:訂單編號(hào)(自動(dòng)生成),酒店編號(hào),房間類型,訂房數(shù)目,訂者姓名,聯(lián)系電話,email地址
要求:
1、增加訂單時(shí)訂房數(shù)目必須小于此類型酒店的空房數(shù),有了訂單后,酒店的空房數(shù)應(yīng)相應(yīng)減少,取消訂單后相應(yīng)增加。(由于沒(méi)有對(duì)訂單的日期做比較,所有訂單長(zhǎng)期有效,和實(shí)際情況有所出入)
2、查詢資料時(shí),輸出的資料應(yīng)格式化對(duì)齊。臺(tái)頭有中文說(shuō)明。
3、使用類來(lái)定義酒店資料和訂單資料,并且對(duì)<>(輸入)運(yùn)算符進(jìn)行重載,以格式化輸出。
4、菜單選擇錯(cuò)誤時(shí),有退出機(jī)制,不需要完成菜單項(xiàng)的內(nèi)容也可以退出。
5、所有資料保存在文件中。
6、使用STL類庫(kù)來(lái)添加和刪除資料。
7、代碼中有足夠的注釋,可以讓開(kāi)發(fā)者以外的人很快看明白。
8、使用頭文件和源代碼分開(kāi)的形式。(2個(gè)文件,1個(gè).h,一個(gè).cpp)
9、對(duì)輸入有校驗(yàn),如輸入的類型不對(duì),應(yīng)該有提示重新輸入。

代碼片段和文件信息
#include?
#include?
#include?
#include?
#include
#include?“HotelInfo.h“
#include?“HotelOrder.h“
using?namespace?std;
int?Add_Hotel()
{
list?hotel_list;
HotelInfo?hotel;
if(hotel.InputInfo()==-1)
return?-1;
hotel_list.push_back(hotel);
SaveFile(hotel_listtrue);
return?0;
}
void?Del_Hotel()
{
list?del_list;
HotelInfo?del;
LoadFile(del_list);
int?flag=0rid;
string?id;
cout<<“請(qǐng)輸入要?jiǎng)h除的酒店編號(hào):“;
cin>>id;
while(1)
{
if?(checknum(id)||Inputcheck(id))
{
break;
}
else
{
???? cout<<“您的輸入不正確,請(qǐng)重新輸入!!!“< cout<<“請(qǐng)輸入對(duì)應(yīng)數(shù)字:“;
cin>>id;
}
}
rid=atoi(id.c_str());
list::iterator?it=del_list.begin();
while?(it!=del_list.end())
{
if?(it->m_HId==rid)
{
flag=1;
del_list.erase(it);
SaveFile(del_listfalse);
return;
}
it++;
}
if?(flag==0)
{
cout<<“您要?jiǎng)h除的酒店編號(hào)不存在!!!“< }
}
int?Add_Order()
{
list?AddO;
HotelOrder?AO;
if(AO.Inputinfo()==-1)
return?-1;
AddO.push_back(AO);
SaveFile_O(AddOtrue);
return?0;
}
void?Cancel_Order()
{
int?tmp_hid;
list?can_o;
list?h_list;
LoadFile(h_list);
HotelInfo?can;
LoadFile_O(can_o);
int?flag=0flag1=0;
string?id;
cout<<“請(qǐng)輸入要?jiǎng)h除的訂單編號(hào):“;
cin>>id;
while(1)
{
if?(CheckReOid(id)||Inputcheck(id))
{
break;
}
else
{
cout<<“您的輸入的訂單編號(hào)不存在!!!“< cout<<“請(qǐng)輸入對(duì)應(yīng)數(shù)字:“;
cin>>id;
}
}
list::iterator?it1=h_list.begin();
list::iterator?it=can_o.begin();
while?(it!=can_o.end())
{
if?(it->m_OId==id)
{
tmp_hid=it->m_HId;
while?(it1!=h_list.end())
{
if?(it1->m_HId==tmp_hid)
{
flag1=1;
break;
}
it1++;
}
if?(flag1==0)
{
string?x;
cout<<“您要?jiǎng)h除的訂單對(duì)應(yīng)的酒店已經(jīng)不存在了!!!“< cout<<“您是否要繼續(xù)刪除訂單,(Y/N):“;
cin>>x;
if?(x==“y“||x==“Y“)
{
can_o.erase(it);
SaveFile_O(can_ofalse);
return;
}
else
{
break;
}
}
if(flag1==1)
{
flag=1;
UpdataInfo_order(h_listit->m_ORoomTypeit->m_HIdit->m_ONum);
SaveFile(h_listfalse);
can_o.erase(it);
SaveFile_O(can_ofalse);
break;
}
}
it++;
}
if(flag==1)
{
cout<<“刪除訂單成功!!!“< }
}
void?Search_City()
{
list?H_Search;
HotelInfo?search;
LoadFile(H_Search);
string?city;
int?kflag=0;
k=CountLines(“test.txt“);
if(k>0)
{
list::iterator?it=H_Search.begin();
cout<<“根據(jù)城市查找酒店:“;
cin>>city;
cout<<“酒店編號(hào)“< <<“普通空房數(shù)“< while(it!=H_Search.end())
{
if?(it->m_Hcity==city)
{
flag=1;
cout<m_HId<m_Hname<m_Hcity<
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-08-24?09:41??Hotel\
?????目錄???????????0??2011-08-24?09:41??Hotel\Debug\
?????文件?????2794496??2011-08-23?16:54??Hotel\Debug\Hotel.bsc
?????文件??????696403??2011-08-23?16:54??Hotel\Debug\Hotel.exe
?????文件?????1298164??2011-08-23?16:54??Hotel\Debug\Hotel.ilk
?????文件??????284299??2011-08-23?15:07??Hotel\Debug\Hotel.obj
?????文件?????2616480??2011-08-23?15:34??Hotel\Debug\Hotel.pch
?????文件?????1532928??2011-08-23?16:45??Hotel\Debug\Hotel.pdb
?????文件???????????0??2011-08-23?15:07??Hotel\Debug\Hotel.sbr
?????文件??????460427??2011-08-23?16:22??Hotel\Debug\HotelInfo.obj
?????文件???????????0??2011-08-23?16:22??Hotel\Debug\HotelInfo.sbr
?????文件??????460017??2011-08-23?16:54??Hotel\Debug\HotelOrder.obj
?????文件???????????0??2011-08-23?16:54??Hotel\Debug\HotelOrder.sbr
?????文件??????238592??2011-08-23?16:54??Hotel\Debug\vc60.idb
?????文件??????176128??2011-08-23?16:45??Hotel\Debug\vc60.pdb
?????文件????????5918??2011-08-23?14:50??Hotel\Hotel.cpp
?????文件????????4532??2011-08-20?16:41??Hotel\Hotel.dsp
?????文件?????????518??2011-08-20?10:13??Hotel\Hotel.dsw
?????文件???????74752??2011-08-23?16:54??Hotel\Hotel.ncb
?????文件???????55808??2011-08-23?16:54??Hotel\Hotel.opt
?????文件?????????433??2011-08-23?16:54??Hotel\Hotel.plg
?????文件????????8093??2011-08-23?15:34??Hotel\HotelInfo.cpp
?????文件????????1721??2011-08-23?15:06??Hotel\HotelInfo.h
?????文件????????6779??2011-08-23?16:54??Hotel\HotelOrder.cpp
?????文件?????????997??2011-08-22?23:12??Hotel\HotelOrder.h
?????文件??????????51??2011-08-23?16:47??Hotel\order.txt
?????文件??????????47??2011-08-23?16:47??Hotel\test.txt
?????文件?????????323??2011-08-24?10:17??Hotel\復(fù)件?test.txt
評(píng)論
共有 條評(píng)論