《賓館客房管理系統(tǒng)》程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告.doc_第1頁
《賓館客房管理系統(tǒng)》程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告.doc_第2頁
《賓館客房管理系統(tǒng)》程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告.doc_第3頁
《賓館客房管理系統(tǒng)》程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告.doc_第4頁
《賓館客房管理系統(tǒng)》程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告.doc_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

賓館客房管理系統(tǒng)程序設(shè)計(jì)基礎(chǔ)課程設(shè)計(jì)報(bào)告專 業(yè): 電子信息工程 班 級: 11電信2班 姓 名: 學(xué) 號(hào): 指導(dǎo)老師: 2012年2月20日報(bào)告內(nèi)容一 課程設(shè)計(jì)目的二 課程設(shè)計(jì)題目描述和要求三 功能模塊說明四 源文件五 參考書目六 課程設(shè)計(jì)總結(jié)一課程設(shè)計(jì)目的這次課程設(shè)計(jì)是檢驗(yàn)學(xué)習(xí)成果的好機(jī)會(huì),經(jīng)過一個(gè)學(xué)期的學(xué)習(xí),對于程序設(shè)計(jì)的掌握程度如何?能否熟練運(yùn)用?都將在這份報(bào)告中得到體現(xiàn)。也是對于程序設(shè)計(jì)的系統(tǒng)復(fù)習(xí)。二課程設(shè)計(jì)題目描述和要求賓館客房管理系統(tǒng)要求1、有啟動(dòng)和退出界面2、采用按鍵或菜單選擇方法,選擇相應(yīng)的功能(錄入、刪除、查詢、統(tǒng)計(jì)、打印和退出)3、要求系統(tǒng)具有下列功能:錄入6條住戶資料,包括姓名、性別、身份證號(hào)、天數(shù)、預(yù)交押金、房間號(hào)等字段;錄入一個(gè)賓館的所有房間號(hào)信息,包括房間號(hào)、共有床位數(shù)、已住客人數(shù)等字段(其中已住客人數(shù)應(yīng)計(jì)算出來);所錄入的數(shù)據(jù)分別存入兩個(gè)文本文件中;能根據(jù)情況能調(diào)出數(shù)據(jù)。具有對錄入數(shù)據(jù)進(jìn)行插入功能,即有客人入住,應(yīng)根據(jù)房間中已住的客人數(shù),性別等判斷分配房間;具有對錄入數(shù)據(jù)進(jìn)行刪除功能,即當(dāng)客人退房,應(yīng)將其房間清空。具有查詢功能,能按房間號(hào)查詢?nèi)藬?shù);能根據(jù)性別查詢房間號(hào)及可住人數(shù)。具有統(tǒng)計(jì)功能,能根據(jù)天數(shù)統(tǒng)計(jì)出常住客人數(shù)和短期客人數(shù)。具有打印功能,即能在文件中和屏幕上輸出房間號(hào)和對應(yīng)的客人數(shù)。三功能模塊說明1.功能綜述:該管理系統(tǒng)包括:客房信息的錄入、修改、刪除、剩余客房信息查詢、排序、輸出。客房信息可寫入文件,也可從文件中讀取??头啃畔⑸婕暗臄?shù)據(jù)有客房編號(hào)、客房類型、定房日期、客房內(nèi)容(設(shè)施)、定房有效期等。 2.結(jié)構(gòu)模塊:賓館客房管理系統(tǒng)錄入客房信息保存客房信息修改客房信息刪除客房信息查詢剩余客房排序剩余客房輸出剩余退出系統(tǒng)3.程序演示(1)主頁面主頁面中顯示了exe程序的主要功能(2)客房信息錄入演示中錄入了編號(hào)1的房間信息為標(biāo)間、日期2月4日、價(jià)格100元、以及帶有浴室等信息。(3)刪除信息通過輸入編號(hào)2,刪除了編號(hào)2的房間信息。(4)查詢房間通過房間編號(hào)查詢到了該房間信息,同時(shí)還可以通過類型和價(jià)格查詢到相應(yīng)房間信息。四源文件#include using namespace std;#include/包含文件流頭文件#define BUFSIZE 50class cGuestroom;void FindTheGuestroom(); /查找客房void FindTheGuestroomById(); /按照編號(hào)找客房void FindTheGuestroomByType(); /按照類型找客房void FindTheGuestroomByPrice(); /按照價(jià)格找客房void DeleteTheGuestroom(); /刪除客房void AddTheGuestroom(); /客房添加void ModifyTheGuestroom(); /修改客房 template /template:模板,樣板class cNode /節(jié)點(diǎn)public: T data; cNode *next;template class tList public: /定義成員函數(shù)tList();void Create(); /創(chuàng)建鏈表bool Empty() const; /判斷鏈表是否為空void Insert(const T e); /從尾部插入一個(gè)元素cNode* GetcNode(int i); /返回第i個(gè)節(jié)點(diǎn)bool Find(const T e); /在鏈表中查找某個(gè)值tList(); /銷毀鏈表,析構(gòu) cNode *head; /頭節(jié)點(diǎn);template tList:tList() /類的成員函數(shù)的實(shí)現(xiàn)head=new cNode;head-next=NULL;template void tList:Create() cNode *p;p=head;p-next=NULL;template bool tList:Empty() const return (head-next=NULL);template void tList:Insert(const T e) /insert:插入 cNode *p,*q;p=head;q=new cNode;q-data=e;while(p-next)p=p-next;p-next=q;q-next=NULL;template cNode* tList:GetcNode(int i) /返回第i個(gè)節(jié)點(diǎn)int k=0; cNode *p;p=head;while(p & knext;+k;return p;template bool tList:Find(const T e) /在鏈表中查找某個(gè)值bool flag=false; cNode *p;p=head-next;while(p)if(p-data=e)flag=true;break;p=p-next;return flag;template tList:tList()cNode *p;while(head)p=head-next;delete head;head=p;class cGuestroompublic:char IDBUFSIZE; /客房編號(hào)char TypeBUFSIZE; /客房類型char BookBUFSIZE; /提前定房日期char PriceBUFSIZE; /客房價(jià)格char FunctionBUFSIZE; /客房主要內(nèi)容int StayTime; /入住天數(shù)有效期bool flag;/標(biāo)志cGuestroom()/構(gòu)造函數(shù)初始化memset(ID,0,BUFSIZE);memset(Type,0,BUFSIZE);memset(Book,0,BUFSIZE);memset(Function,0,BUFSIZE);memset(Price,0,BUFSIZE);StayTime=0.0;flag=false; /memset:把char類型轉(zhuǎn)換成ASCII值;void ReadData(tList *tListGue)/讀取數(shù)據(jù)庫char bufBUFSIZE; ifstream ifile(Guestroom.txt,ios_base:in);/創(chuàng)建一個(gè)輸出文件流對象if (!ifile) cerr 讀取時(shí)打開文件出錯(cuò)! Insert(Guestroom);cout讀取數(shù)據(jù)成功!nn;ifile.close();/關(guān)閉文件return;void AddtheGuestroom(tList *tListGue)/ 輸入客房函數(shù)cGuestroom tempGuestroom; /定義臨時(shí)客房cout下面開始添加客房信息n;couttempGuestroom.ID; /讀入客房編號(hào)couttempGuestroom.Type; /讀入客房類型couttempGuestroom.Book; /讀入定房日期couttempGuestroom.Price; /讀入價(jià)格couttempGuestroom.Function; /讀入主要內(nèi)容couttempGuestroom.StayTime; /讀入入住有效期tempGuestroom.flag=true;tListGue-Insert(tempGuestroom);cout添加成功!n;system(pause); /pause:停頓,終止system(cls);void SaveData(tList *tListGue) /保存數(shù)據(jù)int i=0;ofstream ofile(Guestroom.txt,ios_base:out);/創(chuàng)建一個(gè)輸入文件流對象if (!ofile) cerr 保存時(shí)打開文件出錯(cuò)! endl; cNode *p;p=tListGue-head-next;while(p) /從內(nèi)存中讀取數(shù)據(jù),存到外盤if(p-data.flag)ofilen;ofiledata).IDn;ofiledata).Typen;ofiledata).Bookn;ofiledata).Pricen;ofiledata).Functionn;ofiledata).StayTimenext;cout保存數(shù)據(jù)成功!n;ofile.close();system(pause);system(cls);return;void ModifytheGuestroom(tList *tListGue) /修改客房信息char idBUFSIZE;coutid; /讀取客房編號(hào)bool flag=false; cNode *p;p=tListGue-head-next;while(p)if(strcmp(p-data.ID,id)=0 & p-data.flag)flag=true;break;p=p-next;if(flag=true) /顯示屏幕cout找到了,該客房的原始信息是:n;coutnn客房編號(hào):data).IDt客房類型:data).Typentt定房日期:data).Bookntt價(jià)格:data).Price;coutntt客房的主要內(nèi)容:data).Functionntt入住有效期:data).StayTime;coutn下面開始修改該客房的信息:n;cGuestroom tempGuestroom; /定義臨時(shí)客房couttempGuestroom.ID; /讀入客房編號(hào)couttempGuestroom.Type; /讀入客房類型couttempGuestroom.Book; /讀入定房日期couttempGuestroom.Price; /讀入價(jià)格couttempGuestroom.Function; /讀入客房的主要內(nèi)容couttempGuestroom.StayTime; /讀入入住有效期tempGuestroom.flag=true;p-data=tempGuestroom;cout修改成功!; coutendl;system(pause);system(cls);return;void DeletetheGuestroom(tList *tListGue) /刪除客房信息char idBUFSIZE;coutid; /讀取客房編號(hào)bool flag=false;int count=0; cNode *p;p=tListGue-head-next;while(p)if(strcmp(p-data.ID,id)=0 & p-data.flag)count+;flag=true;break;p=p-next;if(flag=false) cout對不起,你所查找的客房延長了住房日期!n;/如果不能刪else /如果能刪 count-;cout找到了,該客房的原始信息是:n;coutnn客房編號(hào):data).IDt客房類型:data).Typentt定房日期:data).Bookntt價(jià)格:data).Price;coutntt客房的主要內(nèi)容:data).Functionntt入住有效期:data).StayTime;coutdata).flag=false;cout該客房的信息刪除成功!n; coutendl;system(pause);system(cls);return;void FindtheremainGuestroomById(tList *tListGue)/根據(jù)客房編號(hào)查找char idBUFSIZE;coutid; /讀取客房編號(hào)bool flag=false; cNode *p;p=tListGue-head-next;while(p)if(strcmp(p-data.ID,id)=0 & p-data.flag)flag=true;break;p=p-next;if(flag=false) cout對不起,沒有該標(biāo)號(hào)的客房!n; /如果找不到else /如果找到了 coutn找到了,該客房的信息是:n;coutnn客房編號(hào):data).IDt客房類型:data).Typentt定房日期:data).Bookntt價(jià)格:data).Price;coutntt主要內(nèi)容:data).Functionntt入住有效期:data).StayTime; coutendl;system(pause);system(cls); /清屏return;void FindtheremainGuestroomByType(tList *tListGue)/根據(jù)客房類型查找客房char typeBUFSIZE;couttype; /讀取客房類型bool flag=false; cNode *p;p=tListGue-head-next;while(p)if(strcmp(p-data.Type,type)=0 & p-data.flag)flag=true;break;p=p-next;if(flag=false) cout對不起,沒有該類型的客房!n; /如果滿了else /如果找到了coutn找到了,該客房信息是:n;coutnn客房編號(hào):data).IDt客房類型:data).Typentt定房日期:data).Bookntt價(jià)格:data).Price;coutntt客房的主要內(nèi)容:data).Functionntt入住有效期:data).StayTime; coutendl;system(pause);system(cls);return;void FindtheremainGuestroomByPrice(tList *tListGue)/根據(jù)價(jià)格查找客房char priceBUFSIZE;coutprice; /讀取價(jià)格bool flag=false; cNode *p;p=tListGue-head-next;while(p)if(strcmp(p-data.Price,price)=0 & p-data.flag)flag=true;coutnn客房編號(hào):data).IDt客房類型:data).Typentt定房日期:data).Bookntt價(jià)格:data).Price;coutntt客房的主要內(nèi)容:data).Functionntt入住有效期:data).StayTime;p=p-next;if(flag=false) cout對不起,沒有你所要求價(jià)格的客房!n; /如果找不到coutendl;system(pause);system(cls);return;void FindtheremainGuestroom(tList *tListGue)/查找客房system(cls);while(1)coutnnnn;cout 1:按客房編號(hào)查詢nn;cout 2:按客房類型查詢nn;cout 3:按價(jià)格查詢nn;cout 4:退出查詢nn;coutchoose;switch(choose) /根據(jù)用戶選擇case 1:FindtheremainGuestroomById(tListGue); /按客房編號(hào)查詢break;case 2:FindtheremainGuestroomByType(tListGue); /按客房類型查詢break;case 3:FindtheremainGuestroomByPrice(tListGue); /按價(jià)格查詢break;case 4:system(cls);return; /退出查詢default:break;return;void RanktheremainGuestroom(tList *tListGue) /排序剩余客房cNode *p,*q;cGuestroom remainGuestroom;for (p=tListGue-head-next; p!= NULL; p=p-next)for (q=p; q!= NULL; q=q-next)if (p-data.StayTime q-data.StayTime)remainGuestroom.flag = p-data.flag; strcpy(remainGuestroom.ID, p-data.ID); /復(fù)制strcpy(remainGuestroom.Type, p-data.Type);strcpy(remainGuestroom.Book, p-data.Book); strcpy(remainGuestroom.Price, p-data.Price);strcpy(remainGuestroom.Function, p-data.Function);remainGuestroom.StayTime = p-data.StayTime;p-data.flag = q-data.flag; strcpy(p-data.Function, q-data.Function);strcpy(p-data.ID, q-data.ID); strcpy(p-data.Type, q-data.Type);strcpy(p-data.Book, q-data.Book); p-data.StayTime = q-data.StayTime; q-data.flag = remainGuestroom.flag; strcpy(q-data.Function, remainGuestroom.Function);strcpy(q-data.ID, remainGuestroom.ID);strcpy(q-data.Type, remainGuestroom.Type);strcpy(q-data.Book, remainGuestroom.Book); q-data.StayTime = remainGuestroom.StayTime; void OutputtheremainGuestroom(tList *tListGue) /輸出剩余房間函數(shù)cNode *p;p=tListGue-head-next;while(p)if(p-data.flag)coutnn客房編號(hào):data).IDt客房類型:data).Typentt提前定房日期:data).Bookntt價(jià)格:data).Price;coutntt主要內(nèi)容:data).Functionntt入住有效期:data).StayTime;p=p-next;coutendl;system(pause); /停止system(cls); /清屏return;int main()tList tListGue; tListGue.Create(); /創(chuàng)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論