![優(yōu)選酒店管理優(yōu)選星級酒店管理系統(tǒng)代碼_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/21/fa0ead7e-014b-4aab-b82b-0798059d0ea3/fa0ead7e-014b-4aab-b82b-0798059d0ea31.gif)
![優(yōu)選酒店管理優(yōu)選星級酒店管理系統(tǒng)代碼_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/21/fa0ead7e-014b-4aab-b82b-0798059d0ea3/fa0ead7e-014b-4aab-b82b-0798059d0ea32.gif)
![優(yōu)選酒店管理優(yōu)選星級酒店管理系統(tǒng)代碼_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/21/fa0ead7e-014b-4aab-b82b-0798059d0ea3/fa0ead7e-014b-4aab-b82b-0798059d0ea33.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、#include <windows.h>#include <dos.h>#include<stdio.h>#include<stdlib.h>#include<time.h>/結構定typedef struct CheckinInformation char name10;/int id;/int roomType;/int countType;/CheckinInfo;姓名證件號房型計費方式typedef struct HotelRoomint roomType;/int roomNum;/int checked;/int pric
2、e;/Room;房型入住情況房價/ 已入住房數(shù)/ 單人房剩余房數(shù)/ 雙人房剩余房數(shù)/ 大床房剩余房數(shù)枚舉類型 typedef struct RoomOrderCheckinInfo *checkinInfo; long date;Room * room;Order;typedef struct HotelInfomation int checkinAmount;int singleRemainAmount;int doubleRemainAmount; int bigRemainAmount;HotelInfo;/ 入住信息/ 入住時間/ 房間信息enum MainUI,HotelInfoUI
3、,CheckinUI,CheckinResultUI,OrderUI,CheckOutUI,Exit;/GUI enum Single,Double,Big;/Room Typeenum Hour,Day;/countType/ 全局變量 int GUI = MainUI;Order* orderList100;/ 訂單數(shù)組Room* roomList100;/ 房間數(shù)組HotelInfo * hotelInfo = NULL;/酒店房間信息/ 函數(shù)聲明 void initiallizeRoomList();void insertToOrderList(Order * order);Room*
4、 getRoomByType(int roomType); Order* getOrderByRoomNum(int roomNum); void showMainUI();void showHotelInfoUI();void showCheckinUI();void showCheckinResultUI();void showOrderUI();void showCheckOutUI();/Main 函數(shù) void main() / 主函數(shù) / 初始化酒店房間信息hotelInfo = (HotelInfo *)malloc(sizeof(HotelInfo); hotelInfo -&
5、gt; singleRemainAmount = 20; hotelInfo -> doubleRemainAmount=40;hotelInfo -> bigRemainAmount=40;hotelInfo -> checkinAmount=0;/ 初始化房間列表 initiallizeRoomList();/ 界面顯示while(GUI != Exit)switch(GUI)case MainUI: showMainUI(); break;case HotelInfoUI: showHotelInfoUI(); break;case CheckinUI: showChe
6、ckinUI(); break;case CheckinResultUI: showCheckinResultUI(); break;case OrderUI: showOrderUI(); break;case CheckOutUI: showCheckOutUI(); break;default:break;/ 函數(shù)定義 void initiallizeRoomList()/ 房間數(shù)組初始化, 初始化的結果是讓 roomList 的數(shù)組有 100 個 room 指針,而且設置了相應 的值int i;Room*newRoom=NULL;for(i=0;i<20;i+) / 單人房房間信
7、息初始化newRoom = ( Room* )malloc(sizeof(Room);roomListi = newRoom;roomListi->checked=0; roomListi->price=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->pr
8、ice=180;roomListi->roomNum=i+1;roomListi->roomType=Double;for(i=60;i<100;i+) / 大床房房間信息初始化newRoom = ( Room* )malloc(sizeof(Room);roomListi = newRoom;roomListi->checked=0;roomListi->price=180;roomListi->roomNum=i+1;roomListi->roomType=Big;/ 通過所選擇的房型獲取空房間, 獲取房間后將房間信息改為已入住, 并減少相應房型的
9、剩余房間 數(shù)Room* getRoomByType(int roomType)int i;switch(roomType)case Single:for(i=0;i<20;i+)if( roomListi->checked = 0)roomListi->checked=1; hotelInfo->singleRemainAmount - ; hotelInfo->checkinAmount+; return roomListi;break;case Double:for(i=20;i<60;i+)if( roomListi->checked = 0)r
10、oomListi->checked=1; hotelInfo->doubleRemainAmount - ; hotelInfo->checkinAmount+; return roomListi;break;case Big:for(i=60;i<100;i+)if( roomListi->checked = 0)roomListi->checked=1; hotelInfo->bigRemainAmount -; hotelInfo->checkinAmount+; return roomListi;break;/ 將訂單放入訂單列表void
11、 insertToOrderList(Order * order)int i;for( i = 0;i<100;i+)if( orderListi =NULL )orderListi = order; break;/ 通過房號查詢訂單Order* getOrderByRoomNum(int roomNum)int i;for(i=0;i<100;i+)if( orderListi->room->roomNum = roomNum) return orderListi;void showMainUI()/ 顯示主界面,并接受輸入int chooseNum;system(&
12、quot;cls");printf("nn= 酒 店 房 間 登 記 與 計 費 管 理 管 理 系 統(tǒng) =tnnn");printf("*tttt1.入住登記 tttt*n");printf("*tttt2.查詢?nèi)胱∏闆r ttt*n");printf("*tttt3.查詢當前費用 ttt*n");printf("*tttt4.結賬退房 tttt*n");printf("*tttt5.退出程序 tttt*nnn");printf("nn= 酒 店 房 間
13、登 記 與 計 費 管 理 管 理 系 統(tǒng)=tnnn"); printf(" 請輸入相應編號進入菜單 t"); / 接受輸入 scanf("%d",&chooseNum); switch(chooseNum)case 1:GUI = HotelInfoUI;break;case 2:GUI = HotelInfoUI;break;case 3:GUI = OrderUI;break;case 4:GUI = OrderUI; break;case 5: Sleep(3000); GUI = Exit; break;default: br
14、eak;void showHotelInfoUI()int chooseNum;system("cls");printf("nn= 酒 店 入 住 情 況 查 詢 菜 單 =tnnnn");printf("*ttt入住房間數(shù) : %dtttt*n", hotelInfo->checkinAmount);printf("*ttt剩余房間數(shù) : t");printf(" 單人房: %dtt*n",hotelInfo->singleRemainAmount);printf("*t
15、tttt雙人房: %dtt*n",hotelInfo->doubleRemainAmount);printf("*ttttt大床房: %dtt*nn",hotelInfo->bigRemainAmount);printf("nn= 酒 店 入 住 情 況 查 詢 菜 單 =tnnn");printf(" 按 0 :返回 n"); printf(" 按 1 : 登記入住 n");scanf("%d",&chooseNum);switch(chooseNum)case
16、0:GUI = MainUI; break;case 1:GUI = CheckinUI; break;default:GUI = HotelInfoUI; break;void showCheckinUI()Order * newOrder;Room* newRoom = NULL;/ 填寫一個新的入住信息CheckinInfo * newCheckinInfo = NULL; int roomTypeNum;int countTypeNum;time_t timep;system("cls");printf("nn= 酒 店 入 住 登 記 菜 單 =tnnn
17、");newCheckinInfo = ( CheckinInfo * )malloc(sizeof(CheckinInfo);printf("*tt 請輸入姓名 :");scanf("%s", &(newCheckinInfo->name) );printf("*tt請輸入證件號 :");scanf("%d", &(newCheckinInfo->id) );printf("*tt請選擇入住房型 :n");printf("ttt1.單人房 ntt
18、t2. 雙人房 nttt3. 大床房 n");scanf("%d",&(roomTypeNum);switch(roomTypeNum)/通過輸入的數(shù)字對應房型case 1:newCheckinInfo->roomType = Single;break;case 2:newCheckinInfo->roomType = Double;break;case 3:newCheckinInfo->roomType = Big;break;default:newCheckinInfo->roomType = Single;break;pri
19、ntf("*tt 請選擇計費方式 :n");printf("ttt1.按小時計費 ; nttt2. 按天數(shù)計費 n");/通過輸入的數(shù)字對應計費方式scanf("%d",&countTypeNum);switch(countTypeNum)case 1:newCheckinInfo->countType = Hour;break;case 2:newCheckinInfo->countType = Day;break;printf("nn= 酒 店 入 住 登 記 菜 單 =tnnn");/ 生
20、成一個新的訂單newOrder = ( Order* )malloc(sizeof(Order);newOrder -> 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);
21、break; newOrder->room = newRoom; insertToOrderList(newOrder);printf(" 房間號為 :%dn",newOrder->room->roomNum); GUI = CheckinResultUI;void showCheckinResultUI()int chooseNum; printf("nn/酒店通過房型獲取房間住登記確認菜單=tnnn"); printf("ttt*ttttn"); printf("ttt* 登記成功 *ttttn&quo
22、t;); printf("ttt*ttttnn"); printf("nn=酒店住登記確認菜單=tnnn");printf(" 按 0 :返回 n");scanf("%d",&chooseNum);switch(chooseNum)case 0:GUI = MainUI; break;default:GUI = CheckinResultUI; break;void showOrderUI()int roomNum;int chooseNum;int amount;Order * theOrder = NU
23、LL;system("cls");菜單printf("nn= 酒 店 房 間 信 息 查 詢 =tnnn");printf(" 請輸入房間號 :");scanf("%d",&roomNum);if (roomNum<0 | roomNum>100)printf("n 輸入有誤請重新輸入 ") ;GUI = OrderUI;elsetheOrder = getOrderByRoomNum(roomNum);printf(" 房型: ");switch(the
24、Order->room->roomType)case Single:printf(" 單人房 n");break;case Double:printf(" 雙人房 n");break;case Big:printf(" 大床房 n");break;printf(" 計費方式: "); switch(theOrder->checkinInfo->countType ) case Hour:printf(" 小時計費 n");amount = (time(0) - theOrder->date) / 3600 +1;prin tf("已入住時間:d 小時 n",amou nt);break;case Day:printf(" 天計費 n");amoun
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年全球及中國陶瓷結合劑CBN砂輪行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球LED體育計分板行業(yè)調(diào)研及趨勢分析報告
- 2025-2030全球垂直層流潔凈工作臺行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國大學規(guī)劃App行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國無機助焊劑行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 《Java程序設計教程 (任務驅(qū)動式)》全套教學課件
- 2025-2030全球絲束浸漬機行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國技術技能評估平臺行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國航空自動駕駛儀行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國儲罐除銹機器人行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年度高端商務車輛聘用司機勞動合同模板(專業(yè)版)4篇
- GB/T 45107-2024表土剝離及其再利用技術要求
- 2025長江航道工程局招聘101人歷年高頻重點提升(共500題)附帶答案詳解
- 2025年黑龍江哈爾濱市面向社會招聘社區(qū)工作者1598人歷年高頻重點提升(共500題)附帶答案詳解
- 執(zhí)行總經(jīng)理崗位職責
- 《妊娠期惡心嘔吐及妊娠劇吐管理指南(2024年)》解讀
- 《黑神話:悟空》跨文化傳播策略與路徑研究
- 《古希臘文明》課件
- 居家養(yǎng)老上門服務投標文件
- 長沙市公安局交通警察支隊招聘普通雇員筆試真題2023
- 2025年高考語文作文滿分范文6篇
評論
0/150
提交評論