![酒店管理系統(tǒng)代碼_第1頁](http://file4.renrendoc.com/view/2601655d495c84dfe4cbcbd706e80ec2/2601655d495c84dfe4cbcbd706e80ec21.gif)
![酒店管理系統(tǒng)代碼_第2頁](http://file4.renrendoc.com/view/2601655d495c84dfe4cbcbd706e80ec2/2601655d495c84dfe4cbcbd706e80ec22.gif)
![酒店管理系統(tǒng)代碼_第3頁](http://file4.renrendoc.com/view/2601655d495c84dfe4cbcbd706e80ec2/2601655d495c84dfe4cbcbd706e80ec23.gif)
![酒店管理系統(tǒng)代碼_第4頁](http://file4.renrendoc.com/view/2601655d495c84dfe4cbcbd706e80ec2/2601655d495c84dfe4cbcbd706e80ec24.gif)
![酒店管理系統(tǒng)代碼_第5頁](http://file4.renrendoc.com/view/2601655d495c84dfe4cbcbd706e80ec2/2601655d495c84dfe4cbcbd706e80ec25.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
酒店管理系統(tǒng)代碼
#include<windows.h>#include<dos.h>#include<stdio.h>#include<stdlib.h>#include<time.h>typedefstructCheckininformation〃證〃房型〃計(jì)費(fèi)方式charname[10];intid;〃證〃房型〃計(jì)費(fèi)方式introomType;intcountType;}Checkininfo;typedefstructHotelRoomintroomType;〃房型introomNum;〃房號(hào)intchecked;〃入住情況intprice;//房?jī)r(jià))Room;typedefstructRoomOrderCheckininfo*checkinlnfo;息//入住信long//入住時(shí)間Room*room;房間信息}Order;date;//typedefstructHotellnfomation(intcheckinAmount;〃已入住房數(shù)intsingleRemainAmount:房剩余房數(shù)intdoubleRemainAmount;〃單人//雙人房剩余房數(shù)〃大床intbigRemainAmount;房剩余房數(shù))Hotelinfo;//枚舉類enum{MainUI,HotellnfoUI,CheckinUI,CheckinResuItUI,OrderUI,CheckOutUI,Exit)://GUIenum{Single,Double,Big};//RoomTypeenum{Hour,Day};//countType全局變//量intGUI=MainUI:〃大床//全局變Order*orderList[100];〃訂單數(shù)組Room*roomList[100];〃房間數(shù)組Hotelinfo*hotelinfo=NULL;//酒店房間信息//函數(shù)聲明//voidinitiallizeRoomList();voidinsertToOrderList(Order*order);Room*getRoomByType(introomType);Order*getOrderByRoomNum(introomNum);voidshowMainUI();voidshowHotelInfoUI();voidshowCheckinUI();voidshowCheckinResultUI();voidshowOrderUI();//--
數(shù)一
voidvoidshowCheckOutUI();Main函main()//--
數(shù)一
void//初始化酒店房間信息hotelInfo(HotelInfo*)malloc(sizeof(HotelInfo));hotelInfohotelinfo->singleRemainAmount=20;hotelinfo->doubleRemainAmount=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: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));roomList[i]=newRoom;roomList[i]->checked=0;roomList[i]->price=110;roomList[i]->roomNum=i+1;roomList[i]->roomType=Single;}for(i=20;i<60;i++)//雙人房房間信息初始化{newRoom=(Room*)malloc(sizeof(Room));roomList[i]=newRoom;roomList[i]->checked=0;roomList[i]->price=180;roomList[i]->roomNum=i+1;roomList[i]->roomType=Double;}for(i=60;i<100;i++)//大床房房間信息初始化{newRoom=(Room*)malloc(sizeof(Room));roomList[i]=newRoom;roomList[i]->checked=0;roomList[i]->price=180;roomList[i]->roomNum=i+1;roomList[i]->roomType=Big;}}〃通過所選擇的房型獲取空房間,獲取房間后將房間信息改為巳入住,并減少相應(yīng)房型的剩余房間數(shù)Room*getRoomByType(introomType){inti;switch(roomType){caseSingle:for(i=0;i<20;i++){if(roomList[i]->checked==0){roomList[i]->checked=1;hotelInfo->singleRemainAmount--;hotelInfo->checkinAmount++;returnroomList[i];}}break;caseDouble:for(i=20;i<60;i++)if(roomList[i]->checked==0)roomList[i]->checked=1;hotelInfo->doubleRemainAmount;;hotelInfo->checkinAmount++;returnroomList[i];}}break;caseBig:for(i=60;i<100;i++){if(roomList[i]->checked==0){roomList[i]->checked=1;hotelInfo->bigRemainAmount--;hotelInfo->checkinAmount++;returnroomList[i];break;〃將訂單放入訂單列表voidinsertToOrderList(Order*order){inti;for(i=0;i<100;i++){if(orderList[i]==NULL){orderList[i]=order;break;}〃通過房號(hào)查詢訂單Order*getOrderByRoomNum(introomNum){inti;for(i=0;i<100;i++){if(orderList[i]->room->roomNumroomNum){returnorderList[i];voidshowMainUI(){〃顯示主界面,并接受輸入intchooseNum;system("cls");printf("\n\n=============酒店房間登記與計(jì)費(fèi)管理管理系統(tǒng)
printf("*\t\t\t\t1.\t\t\t\t*\n");printf("*\t\t\t\t1.\t\t\t\t*\n");printf("*\t\t\t\t2.\t\t\t*\n");printf("*\t\t\t\t3.\t\t\t*\n");printf("*\t\t\t\t4.\t\t\t\t*\n");printf("*\t\t\t\t5.\t\t\t\t*\n\n\n");\t\n\n\n");入住登記查詢?nèi)胱∏闆r查詢當(dāng)前費(fèi)用結(jié)賬退房退出程序printf("\n\n=============酒店房間登記與計(jì)費(fèi)管理管理系統(tǒng)============\t\n\n\n");printf("請(qǐng)輸入相應(yīng)編號(hào)進(jìn)入菜單\t");〃接受輸入scanf("%d",&chooseNum);switch(chooseNum)case1:GUI=HotelInfoUI;break;case2:GUI=HotelInfoUI;break;case3:GUI=OrderUI;break;case4:GUI=OrderUI;break;case5:Sleep(3000);GUI=Exit;break;default:break;voidshowHotelInfoUI()intchooseNum;system("cls");printf("\n\n======================酒店入住情況查詢菜單=======================\t\n\n\n\n");printf("*\t\t\t入住房間數(shù):%d\t\t\t\t*\n",hotelInfo->checkinAmount);printf("*\t\t\t剩余房間數(shù):\t");printf("單人房:%d\t\t*\n",hotelInfo->singleRemainAmount);printf("*\t\t\t\t\t雙人房:%d\t\t*\n",hotelInfo->doubleRemainAmount);printf("*\t\t\t\t\t大床房:%d\t\t*\n\n",hotelInfo->bigRemainAmount);printf("\n\n=======================酒店入住情況查詢菜單============\t\n\n\n");printf("按0:返回\n");printf("按1:登記入住\n");scanf("%d”,&chooseNum);switch(chooseNum){case0:GUI=MainUI;break;case1:GUI=CheckinUI;break;default:GUI=HotelInfoUI;break;}}voidshowCheckinUI()Order*newOrder;Room*newRoom=NULL;//填寫一個(gè)新的入住信息CheckinInfo*newCheckinInfo=NULL;introomTypeNum;intcountTypeNum;time_ttimep;system("cls");printf("\n\n==============酒店入住登記菜單======================\t\n\n\n");newCheckinInfo=(CheckinInfo*)malloc(sizeof(CheckinInfo));printf("*\t\t請(qǐng)輸入姓名:”);scanf("%s",&(newCheckinInfo->name));printf("*\t\t請(qǐng)輸入證件號(hào):");scanf("%d”,&(newCheckinInfo->id));printf("*\t\t請(qǐng)選擇入住房型:\n");printf("\t\t\t1.單人房\n\t\t\t2.雙人房\n\t\t\t3.大床房\n");scanf("%d”,&(roomTypeNum));switch(roomTypeNum)〃通過輸入的數(shù)字對(duì)應(yīng)房型case1:newCheckinInfo->roomType=Single;break;case2:newCheckinInfo->roomType=Double;break;case3:newCheckinInfo->roomType=Big;break;default:newCheckinInfo->roomType=Single;break;printf("*\t\t請(qǐng)選擇計(jì)費(fèi)方式:\n");printf("\t\t\t1.按小時(shí)計(jì)費(fèi);\n\t\t\t2.按天數(shù)計(jì)費(fèi)\n〃);//通過輸入的數(shù)字對(duì)應(yīng)計(jì)費(fèi)方式scanf("%d”,&countTypeNum);switch(countTypeNum){case1:newCheckinInfo->countType=Hour;break;case2:newCheckinInfo->countType=Day;break;printf("\n\n==============酒店入住登記菜單=============\t\n\n\n");〃生成一個(gè)新的訂單newOrder=(Order*)malloc(sizeof(Order));newOrder->checkinInfo=newCheckinInfo;newOrder->date=time(0);switch(newCheckinInfo->roomType)〃通過房型獲取房間caseSingle:newRoom=getRoomByType(Single);break;caseDouble:newRoom=getRoomByType(Double);break;caseBig:newRoom=getRoomByType(Big);break;}newOrder->room=newRoom;insertToOrderList(newOrder);printf("房間號(hào)為:%d\n”,newOrder->room->roomNum);GUI=CheckinResultUI;:IIP網(wǎng)二Ifio:09SU0}(inn^ssooqo)qoq.iMS:(uinNOSOoq。礦〃p%〃月典osJ(“u\BIB:0潺“)Jiupd:(“u\u\u\4\===================寅毒*股理幕丑V早M=============U\U\")J^UTJd〃u\u\]\i\i\]\************i\]\]\〃)j!id-("U\]\i\i\]\************i\]\]\")jq.uTJd:(“u\u\u\n===================寅毒來映害募町丫早M=============U\U\〃)J^UTJdiinn^asooqoq.ui()imins叫u!H源q^MoqspioAdefault:GUI=CheckinResultUI;break;voidshowOrderUI()introomNum;intchooseNum;intamount;Order*theOrder=NULL;system("cls");printf("\n\n=======================酒店房間信息查詢菜單=======================\t\n\n\n");printf("請(qǐng)輸入房間號(hào):");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");amount=(time(0)-theOrder->date)/(360
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(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ǔ)空間,僅對(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 涉外建設(shè)工程施工合同
- 家居行業(yè)設(shè)計(jì)風(fēng)格與文化內(nèi)涵的融合
- 三農(nóng)行業(yè)手冊(cè)合作社運(yùn)營(yíng)
- 廚房承包合同書參考
- Go語言基礎(chǔ)概念與實(shí)踐作業(yè)指導(dǎo)書
- 內(nèi)部審計(jì)與風(fēng)險(xiǎn)管理作業(yè)指導(dǎo)書
- 擔(dān)保書之擔(dān)保型買賣合同
- 物流信息管理系統(tǒng)作業(yè)指導(dǎo)書
- 私人教練勞動(dòng)合同
- 石油化工行業(yè)安全環(huán)保管理體系建設(shè)方案
- 二零二五年度大型自動(dòng)化設(shè)備買賣合同模板2篇
- 2024版金礦居間合同協(xié)議書
- 2025內(nèi)蒙古匯能煤化工限公司招聘300人高頻重點(diǎn)提升(共500題)附帶答案詳解
- PFMEA模板完整版文檔
- GB/T 4214.1-2017家用和類似用途電器噪聲測(cè)試方法通用要求
- GB/T 11822-2000科學(xué)技術(shù)檔案案卷構(gòu)成的一般要求
- 壓力管道基本知識(shí)課件
- 小學(xué)英語 國(guó)際音標(biāo) 練習(xí)及答案
- 優(yōu)秀班主任經(jīng)驗(yàn)交流課件-班主任經(jīng)驗(yàn)交流課件
- 2023年廣州金融控股集團(tuán)有限公司招聘筆試題庫及答案解析
- 血液科品管圈匯報(bào)-PPT課件
評(píng)論
0/150
提交評(píng)論