酒店管理系統(tǒng)代碼_第1頁(yè)
酒店管理系統(tǒng)代碼_第2頁(yè)
酒店管理系統(tǒng)代碼_第3頁(yè)
酒店管理系統(tǒng)代碼_第4頁(yè)
酒店管理系統(tǒng)代碼_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、#include<windows.h>#include<dos.h>#include<stdio.h>#include<stdlib.h>#include<time.h>/結(jié)構(gòu)定義typedefstructCheckinInformationcharname10;/姓名intid;/證件號(hào)introomType;/房型intcountType;/計(jì)費(fèi)方式CheckinInfo;typedef struct HotelRoomint roomType;int roomNum;int checked;int price;Room;type

2、def struct RoomOrderCheckinInfo *checkinInfo;long date;Room * room;Order;typedef struct HotelInfomationint checkinAmount;int singleRemainAmount;int doubleRemainAmount;int bigRemainAmount;HotelInfo;/ 房型/ 房號(hào)/ 入住情況/ 房?jī)r(jià)/ 入住信息/ 入住時(shí)間/ 房間信息/ 已入住房數(shù)/ 單人房剩余房數(shù)/ 雙人房剩余房數(shù)/ 大床房剩余房數(shù)/枚舉類(lèi)型enumMainUI,HotelInfoUI,Check

3、inUI,CheckinResultUI,OrderUI,CheckOutUI,Exit;/GUIenumSingle,Double,Big;/RoomTypeenumHour,Day;/countType/全局變量intGUI=MainUI;/ 訂單數(shù)組/ 房間數(shù)組Order*orderList100;Room*roomList100;HotelInfo*hotelInfo=NULL;/酒店房間信息/函數(shù)聲明voidinitiallizeRoomList();voidinsertToOrderList(Order*order);Room*getRoomByType(introomType);

4、Order*getOrderByRoomNum(introomNum);voidshowMainUI();voidshowHotelInfoUI();voidshowCheckinUI();voidshowCheckinResultUI();voidshowOrderUI();voidshowCheckOutUI();/Main函數(shù)voidmain()/主函數(shù)/初始化酒店房間信息hotelInfo=(HotelInfo*)malloc(sizeof(HotelInfo);hotelInfo->singleRemainAmount=20;hotelInfo->doubleRemain

5、Amount=40;hotelInfo->bigRemainAmount=40;hotelInfo->checkinAmount=0;/初始化房間列表initiallizeRoomList();/界面顯示while(GUI!=Exit)switch(GUI)caseMainUI:showMainUI();break;caseHotelInfoUI:showHotelInfoUI();break;caseCheckinUI:showCheckinUI();break;caseCheckinResultUI:showCheckinResultUI();break;caseOrderUI

6、:showOrderUI();break;caseCheckOutUI:showCheckOutUI();break;default:break;/函數(shù)定義voidinitiallizeRoomList()/房間數(shù)組初始化,初始化的結(jié)果是讓roomList的數(shù)組有100個(gè)room指針,而且設(shè)置了相應(yīng)的值inti;Room*newRoom=NULL;for(i=0;i<20;i+)/單人房房間信息初始化newRoom=(Room*)malloc(sizeof(Room);roomListi=newRoom;roomListi->checked=0;roomListi->pric

7、e=110;roomListi->roomNum=i+1;roomListi->roomType=Single;for(i=20;i<60;i+)/雙人房房間信息初始化newRoom=(Room*)malloc(sizeof(Room);roomListi=newRoom;roomListi->checked=0;roomListi->price=180;roomListi->roomNum=i+1;roomListi->roomType=Double;for(i=60;i<100;i+)/大床房房間信息初始化newRoom=(Room*)mal

8、loc(sizeof(Room);roomListi=newRoom;roomListi->checked=0;roomListi->price=180;roomListi->roomNum=i+1;roomListi->roomType=Big;/通過(guò)所選擇的房型獲取空房間,獲取房間后將房間信息改為已入住,并減少相應(yīng)房型的剩余房間數(shù)Room*getRoomByType(introomType)inti;switch(roomType)caseSingle:for(i=0;i<20;i+)if(roomListi->checked=0)roomListi-&

9、gt;checked=1;hotelInfo->singleRemainAmount-;hotelInfo->checkinAmount+;returnroomListi;break;caseDouble:for(i=20;i<60;i+)if(roomListi->checked=0)roomListi->checked=1;hotelInfo->doubleRemainAmount-;hotelInfo->checkinAmount+;returnroomListi;break;caseBig:for(i=60;i<100;i+)if(roo

10、mListi->checked=0)roomListi->checked=1;hotelInfo->bigRemainAmount-;hotelInfo->checkinAmount+;returnroomListi;break;/將訂單放入訂單列表voidinsertToOrderList(Order*order)inti;for(i=0;i<100;i+)if(orderListi=NULL)orderListi=order;break;/通過(guò)房號(hào)查詢訂單Order*getOrderByRoomNum(introomNum)inti;for(i=0;i<

11、100;i+)if(orderListi->room->roomNum=roomNum)returnorderListi;voidshowMainUI()(顯示主界面,并接受輸入intchooseNum;system("cls");printf("nn=酒店房間登記與計(jì)費(fèi)管理管理系統(tǒng):=tnnn");printf("*tttt1.入住登記tttt*n");printf("*tttt2.查詢?nèi)胱∏闆rttt*n");printf("*tttt3.查詢當(dāng)前費(fèi)用ttt*n");printf(

12、"*tttt4.結(jié)賬退房tttt*n");printf("*tttt5.退出程序tttt*nnn");printf("nn=酒店房間登記與計(jì)費(fèi)管理管理系統(tǒng):=tnnn");printf("請(qǐng)輸入相應(yīng)編號(hào)進(jìn)入菜單t");/接受輸入scanf("%d",&chooseNum);switch(chooseNum)(case 1:GUI=HotelInfoUI;break;case 2:GUI=HotelInfoUI;break;case 3:GUI=OrderUI;break;case 4:G

13、UI=OrderUI;break;case 5:Sleep(3000);GUI=Exit;break;default:break;voidshowHotelInfoUI()(intchooseNum;system("cls");printf("nn=酒店入住情況查詢菜單:=tnnnn");printf("*ttt入住房間數(shù):dtttt*n",hotelInfo->checkinAmount);printf("*ttt剩余房間數(shù):t");printf("單人房:dtt*n",hotelInf

14、o->singleRemainAmount);printf("*ttttt雙人房:dtt*n",hotelInfo->doubleRemainAmount);printf("*ttttt大床房:dtt*nn",hotelInfo->bigRemainAmount);printf("nn=酒店入住情況查詢菜單:=tnnn");printf("按0:返回n");printf("按1:登記入住n");scanf("%d",&chooseNum);switc

15、h(chooseNum)(case0:GUI=MainUI;break;case1:GUI=CheckinUI;break;default:GUI=HotelInfoUI;break;)voidshowCheckinUI()(Order*newOrder;Room*newRoom=NULL;填寫(xiě)一個(gè)新的入住信息CheckinInfo*newCheckinInfo=NULL;introomTypeNum;intcountTypeNum;time_ttimep;system("cls");printf("nn=酒店入=tnnn");newCheckinInf

16、o=(CheckinInfo*)malloc(sizeof(CheckinInfo);printf("*tt請(qǐng)輸入姓名:");scanf("%s",&(newCheckinInfo->name);printf("*tt請(qǐng)輸入證件號(hào):");scanf("%d",&(newCheckinInfo->id);printf("*tt請(qǐng)選擇入住房型:n");printf("ttt1.單人房nttt2.雙人房nttt3.大床房n");scanf("%

17、d",&(roomTypeNum);switch(roomTypeNum)房型case 1:newCheckinInfo->roomType=Single;break;case 2:newCheckinInfo->roomType=Double;break;case 3:newCheckinInfo->roomType=Big;break;default:newCheckinInfo->roomType=Single;break;printf("*tt請(qǐng)選擇計(jì)費(fèi)方式:n");printf("ttt1.按小時(shí)計(jì)費(fèi);nttt2

18、.按天數(shù)計(jì)費(fèi)n");費(fèi)方式scanf("%d",&countTypeNum);switch(countTypeNum)case 1:newCheckinInfo->countType=Hour;break;住登記菜單/ 通過(guò)輸入的數(shù)字對(duì)應(yīng)/ 通過(guò)輸入的數(shù)字對(duì)應(yīng)計(jì)case 2:newCheckinInfo->countType=Day;break;printf("nn入住 登 記 菜 單tnnn");生成一個(gè)新的訂單newOrder = ( Order* )malloc(sizeof(Order); newOrder ->

19、; checkinInfo = newCheckinInfo;newOrder -> date = time(0);switch(newCheckinInfo->roomType)case Single:newRoom = getRoomByType(Single); break;case Double:newRoom=getRoomByType(Double);break;case Big :newRoom=getRoomByType(Big);break;)/通過(guò)房型獲取房間newOrder->room = newRoom; insertToOrderList(newOr

20、der);printf("房間號(hào)為:dn",newOrder->room->roomNum);GUI = CheckinResultUI;)void showCheckinResultUI() int chooseNum;printf("nn=酒店入住登記確認(rèn)菜單=tnnn");printf("ttt*ttttn");printf("ttt* 登記成功 *ttttn"); printf("ttt*ttttnn");printf("nn=酒店入住登記確認(rèn)菜單:=tnnn&qu

21、ot;);printf("按 0 :返回 n"); scanf("%d",&chooseNum);switch(chooseNum)case0:GUI=MainUI;break;default:GUI=CheckinResultUI;break;voidshowOrderUI()introomNum;intchooseNum;intamount;Order*theOrder=NULL;system("cls");printf("nn=酒店房間信息查詢菜單=tnnn");printf("請(qǐng)輸入房間號(hào)

22、:");scanf("%d",&roomNum);if(roomNum<0|roomNum>100)printf("n輸入有誤請(qǐng)重新輸入");GUI=OrderUI;elsetheOrder=getOrderByRoomNum(roomNum);printf("房型:");switch(theOrder->room->roomType)caseSingle:printf("單人房n");break;caseDouble:printf("雙人房n");break;caseBig:printf("大床房n");break;printf("計(jì)費(fèi)方式:");switch(theOrder->checkinInfo->countType)caseHour:printf("小時(shí)計(jì)費(fèi)n");amount=(time(0)-theOrder->date)/3600+1;printf("已入住時(shí)間:d小時(shí)n",amount);break;caseDay:printf("天計(jì)費(fèi)n");a

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論