九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼

上傳人:仙*** 文檔編號:30522043 上傳時間:2021-10-10 格式:DOC 頁數(shù):17 大?。?6.01KB
收藏 版權申訴 舉報 下載
C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼_第1頁
第1頁 / 共17頁
C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼_第2頁
第2頁 / 共17頁
C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼_第3頁
第3頁 / 共17頁

下載文檔到電腦,查找使用更方便

15 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼》由會員分享,可在線閱讀,更多相關《C語言課程設計 酒店房間登記與計費管理系統(tǒng)源代碼(17頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、酒店房間登記與計費管理系統(tǒng)源代碼#define M 80#include#include#include/*函數(shù)聲明*/void check_in(); /*登記入住函數(shù)*/void chamber(); /*入住情況函數(shù)*/void price(); /*當前費用函數(shù)*/void fee(); /*結賬退房函數(shù)*/void infor(); /*信息查詢函數(shù)*/void save(int); /*保存信息函數(shù)*/void read(int); /*讀取信息函數(shù)*/ void choice(); /*功能選擇函數(shù)*/int judge_year(int); /*判斷閏年函數(shù)*/void inf

2、ormation(); /*輸出全部房間信息*/*結構體*/struct timeint year; int mon;int date;int hour; struct room /*定義各房間信息的結構體*/char name40;char ID18;int flag; /* 0-無人入住,1-按小時計費,2-按天計費 */long int deposit;time t2; /* 0-入住時間,1-當前時間 */ roomM;char c140=0;char c218=0;/*主函數(shù)(主界面)*/void main()system(cls); /*清屏*/system(color 4E);i

3、nt n;printf(*);printf(* *);printf(*tt - 歡迎光臨萬豪酒店 - *);printf(* *);printf(*nn);printf(ttt 1. 登記入住 nn);printf(ttt 2. 入住情況 nn);printf(ttt 3. 當前費用 nn);printf(ttt 4. 結賬退房 nn);printf(ttt 5. 信息查詢 nn);printf(ttt 6. 全部信息 nn);printf(ttt 7. 退出系統(tǒng) nn);printf(請輸入您需要的服務的代碼:);scanf(%d,&n);while(n7) printf(nn代碼輸入有誤,

4、請您重新輸入:); scanf(%d,&n); switch(n) /*根據(jù)輸入數(shù)字選擇功能*/ case 1:check_in();break; /*調(diào)用登記入住函數(shù)*/ case 2:chamber();break; /*調(diào)用房間情況函數(shù)*/ case 3:price();break; /*調(diào)用當前費用函數(shù)*/ case 4:fee();break; /*調(diào)用結賬退房函數(shù)*/ case 5:infor();break; /*調(diào)用信息查詢函數(shù)*/ case 6:information();break; /*調(diào)用全部信息函數(shù)*/ case 7:exit(0); /*調(diào)用退出系統(tǒng)函數(shù)*/*查看房

5、間使用情況函數(shù)*/void chamber() system(cls); /*清屏*/system(color 4E);printf(n*房間使用情況*n);int count=0;int i;int j;int k;int m;for(i=1;i=80;i+) /*統(tǒng)計未入住房間總數(shù)*/read(i);if(roomi-1.flag=0) count+;printf(當前未使用房間數(shù):%dnnn,count);chaxun:printf(請輸入你要查詢的房間號(1-40:單人間,41-80:雙人間):); /*輸入房間號查詢房間入住情況*/scanf(%d,&m);while(m80) pr

6、intf(nn房間號輸入有誤,請您重新輸入:); scanf(%d,&m); read(m);while(roomm-1.flag!=0) printf(nn對不起,該房間已有客人入住,請輸入其他房間號:); scanf(%d,&m);read(m);printf(nn該房間沒有客人入住,您要入住該房間嗎?(1-是,2-否):);scanf(%d,&j);while(j2)printf(nn您的選擇輸入有誤,請您重新輸入:);scanf(%d,&j);if(j=1)check_in();elseprintf(nn您需要繼續(xù)查詢嗎?(1-是,2-否):);scanf(%d,&k);while(k

7、2)printf(nn您的選擇輸入有誤,請您重新輸入:);scanf(%d,&k);if(k=1)goto chaxun;elseprintf(nn);main();/*登記入住函數(shù)*/void check_in()system(cls); /*清屏*/system(color 4E);int i;int j;int l;int k;int tab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31;printf(n*登記入住*n);printf(請輸入您將入住的房間號:);scanf(%d,&i

8、);while(i80) printf(nn房間號輸入有誤,請您重新輸入:); scanf(%d,&i); read(i);while(roomi-1.flag!=0) /*判斷房間是否入住*/ printf(nn對不起,該房間已有客人入住,請輸入其他房間號:); scanf(%d,&i);read(i);printf(nn請輸入您的姓名:); /*客人信息登記*/scanf(%s,roomi-1.name);j=strlen(roomi-1.name);while(j0)printf(nn您的姓名輸入有誤,請您重新輸入:n); scanf(%s,roomi-1.name); j=strlen

9、(roomi-1.name); printf(nn請輸入您的證件號碼:);scanf(%s,roomi-1.ID);j=strlen(roomi-1.ID);while(j!=18)printf(nn您的證件號碼輸入有誤,請您重新輸入:n); scanf(%s,roomi-1.ID); j=strlen(roomi-1.ID); if(i=40) printf(nn您選擇的是單人間,該房間148元/天,8元/小時。nnn); /*選擇計費方式*/ printf(請選擇您的計費方式(1:按小時計費,2:按天計費):);else printf(nn您選擇的是雙人間,該房間128元/天,7元/小時。

10、nnn); printf(請選擇您的計費方式(1:按小時計費,2:按天計費):);scanf(%d,&roomi-1.flag);while(roomi-1.flag2)printf(nn您的計費方式輸入有誤,請您重新輸入:);scanf(%d,&roomi-1.flag);printf(nn請按所示格式輸入您的入住時間(年-月-日-時,時為24小時制):);scanf(%d-%d-%d-%d,&roomi-1.t0.year,&roomi-1.t0.mon,&roomi-1.t0.date,&roomi-1.t0.hour);l=judge_year(roomi-1.t0.year);whi

11、le(roomi-1.t0.year=0)|(roomi-1.t0.mon12)|(roomi-1.t0.datetablroomi-1.t0.mon-1)|(roomi-1.t0.hour=24)printf(nn您的入住時間輸入有誤,請按照格式重新輸入:);scanf(%d-%d-%d-%d,&roomi-1.t0.year,&roomi-1.t0.mon,&roomi-1.t0.date,&roomi-1.t0.hour);l=judge_year(roomi-1.t0.year);printf(nn請輸入您的押金數(shù)額:);scanf(%ld,&roomi-1.deposit);whil

12、e(roomi-1.deposit=0)printf(nn您的押金數(shù)額輸入有誤,請您重新輸入:n);scanf(%ld,&roomi-1.deposit);printf(nn您是否確定您的信息:(1-是,2-否):);scanf(%d,&k);while(k2)printf(nn您的選擇輸入有誤,請您重新輸入:n);scanf(%d,&k);if(k=1)printf(nn您已登記入住成功,祝您在本店住得愉快!nn);save(i);choice();elsecheck_in();/*費用查詢函數(shù)*/void price()system(cls); /*清屏*/system(color 4E)

13、;printf(n*費用查詢*n);int i;int j;int k;int tab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31;int day=0;int hr=0;int total_hour;int total_day;long int price;printf(請輸入您的房間號:);scanf(%d,&i);while(i80) printf(nn您的房間號輸入有誤,請您重新輸入:); scanf(%d,&i); read(i);while(roomi-1.flag=0) /*判

14、斷房間是否已有客人入住*/printf(nn該房間無人入住,請重新輸入您的房間號:);scanf(%d,&i);read(i);printf(nn請按所示格式輸入當前時間(年-月-日-時,時為24小時制):); /*輸入當前時間*/shuru:scanf(%d-%d-%d-%d,&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);while(roomi-1.t1.year=0)|(roomi-1.t1.mon12)|(roomi-1.t1.dateta

15、bjroomi-1.t1.mon-1)|(roomi-1.t1.hour=24)printf(nn您的入住時間輸入有誤,請按照格式重新輸入:);scanf(%d-%d-%d-%d,&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);if(roomi-1.t0.mon!=roomi-1.t1.mon)for(k=roomi-1.t0.mon+1;kroomi-1.t1.mon;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon

16、-1-roomi-1.t0.date+roomi-1.t1.date;elseday+=roomi-1.t1.date-roomi-1.t0.date;hr=roomi-1.t1.hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計費方式計算費用*/if(hr0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i=40)price=8*total_hour;elseprice=7*total_hour;if(roomi-1.flag=2)while(hr0)day=day-1;hr=hr+24;i

17、f(hr8)total_day=day;elsetotal_day=day+1;if(i=40)price=148*total_day;elseprice=128*total_day;while(price0)printf(您的時間輸入有誤,請重新輸入:);goto shuru;printf(nn當前費用為:%ld元.nn,price); /*輸出當前費用*/choice();/*結賬退房函數(shù)*/void fee()system(cls);system(color 4E);printf(n*結賬退房*n);int i;int j;int k;int tab212=31,28,31,30,31,

18、30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31; int day=0;int hr=0;int total_hour;int total_day;long int price;long int fee;printf(請輸入您的房間號:);scanf(%d,&i);while(i80) printf(nn您的房間號輸入有誤,請您重新輸入:); scanf(%d,&i); read(i);while(roomi-1.flag=0) /*判斷房間是否有客人入住*/printf(nn該房間無人入住,請重新輸入您的房間號:);scanf(

19、%d,&i);read(i);printf(nn請按所示格式輸入當前時間(年-月-日-時,時為24小時制):); /*輸入當前時間*/shuru:scanf(%d-%d-%d-%d,&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);while(roomi-1.t1.year=0)|(roomi-1.t1.mon12)|(roomi-1.t1.datetabjroomi-1.t1.mon-1)|(roomi-1.t1.hour=24)printf(nn

20、您的入住時間輸入有誤,請按照格式重新輸入:);scanf(%d-%d-%d-%d,&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);if(roomi-1.t0.mon!=roomi-1.t1.mon)for(k=roomi-1.t0.mon+1;kroomi-1.t1.mon;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon-1-roomi-1.t0.date+roomi-1.t1.date;elseday+=roomi

21、-1.t1.date-roomi-1.t0.date;hr=roomi-1.t1.hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計費方式計算費用*/if(hr0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i=40)price=8*total_hour;elseprice=7*total_hour;if(roomi-1.flag=2)while(hr0)day=day-1;hr=hr+24;if(hr8)total_day=day;elsetotal_day=day+1;if(i=40)p

22、rice=148*total_day;elseprice=128*total_day;while(price0) /*輸出最后的總費用*/printf(nn扣除押金后,您另需支付費用%ld元。,fee);else if(fee=0)printf(nn您所交納的押金恰好能夠支付您的住房費用,您無需另行交錢。);elseprintf(nn您所交納的押金還未使用完,本賓館應支付您余額%ld元。,-fee);printf(nnn您已退房成功,感謝您的光臨,我們下次再見!nn);roomi-1.flag=0;strcpy(roomi-1.name,c1);strcpy(roomi-1.ID,c2);ro

23、omi-1.deposit=0;roomi-1.t0.year=0;roomi-1.t0.mon=0;roomi-1.t0.date=0;roomi-1.t0.hour=0;roomi-1.t1.year=0;roomi-1.t1.mon=0;roomi-1.t1.date=0;roomi-1.t1.hour=0;save(i);choice();/*信息查詢函數(shù)*/void infor()system(cls);system(color 4E);printf(n*信息查詢*n);int i;printf(請輸入您的房間號:);scanf(%d,&i);while(i80) printf(nn

24、您的房間號輸入有誤,請您重新輸入:); scanf(%d,&i); read(i);while(roomi-1.flag=0) /*判斷房間是否有客人入住*/ printf(nn該房間無人入住,請重新輸入您的房間號:);scanf(%d,&i);read(i);printf(nn您的信息如下:nnn); /*輸出客人信息*/printf(姓名:);puts(roomi-1.name);printf(nn);printf(證件號碼:);puts(roomi-1.ID);printf(nn);printf(房間類型:);if(i=40)printf(單人間nnn);elseprintf(雙人間nn

25、n);printf(計費方式:);if(roomi-1.flag=1)printf(按小時計費nnn);elseprintf(按天計費nnn);printf(入住時間:);printf(%d年%d%月%d日%d時nnn,roomi-1.t0.year,roomi-1.t0.mon,roomi-1.t0.date,roomi-1.t0.hour);printf(押金數(shù)額:);printf(%ld元nn,roomi-1.deposit);choice();/*功能選擇函數(shù)*/void choice()printf(n*功能選擇*n);printf(ttt 1. 入住情況 n);printf(ttt

26、 2. 登記入住 n);printf(ttt 3. 當前費用 n);printf(ttt 4. 結賬退房 n);printf(ttt 5. 信息查詢 n);printf(ttt 6. 回主界面 n);printf(ttt 7. 全部信息 n);printf(ttt 8. 退出系統(tǒng) n);int k;printf(請選擇您需要的服務:); /*服務選擇*/scanf(%d,&k);while(k8) printf(nn代碼輸入有誤,請您重新輸入:); scanf(%d,&k); switch(k) case 1:chamber();break; /*調(diào)用房間情況函數(shù)*/ case 2:check

27、_in();break; /*調(diào)用登記入住函數(shù)*/ case 3:price();break; /*調(diào)用當前費用函數(shù)*/ case 4:fee();break; /*調(diào)用結賬退房函數(shù)*/ case 5:infor();break; /*調(diào)用信息查詢函數(shù)*/ case 6:main();break; /*調(diào)用主函數(shù)*/ case 7:information();break; /*調(diào)用全部信息函數(shù)*/ case 8:exit(0); /*調(diào)用退出系統(tǒng)函數(shù)*/*判斷閏年函數(shù)*/int judge_year(int x) if(x%4=0)&(x%100!=0)|(x%400=0)return(1);

28、elsereturn(0);/*全部信息查詢*/void information() system(cls);printf(n*全部信息*n);int i;int j;int k;int year;int month;int date;int hour;int year1;int month1;int day1;int hour1;int tab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31;int day=0;int hr=0;int total_hour;int total_day;lo

29、ng int price;printf(nn請按所示格式輸入當前時間(年-月-日-時,時為24小時制):); /*輸入當前時間*/scanf(%d-%d-%d-%d,&year,&month,&date,&hour);j=judge_year(year);for(i=1;i=80;i+)read(i);if(roomi-1.flag=0)printf(房間%d無人入住。n,i);if(i=40)printf(房間類型:單人間。n);printf(單價:148元/天,8元/小時。n);elseprintf(房間類型:雙人間。n);printf(單價:128元/天,7元/小時。n);elseyea

30、r1=year-roomi-1.t0.year;month1=month-roomi-1.t0.mon;day1=date-roomi-1.t0.date;hour1=hour-roomi-1.t0.hour;while(hour10)day1=day1-1;hour1=hour1+24;printf(房間%d客戶信息如下:n,i);printf(姓名:);puts(roomi-1.name);printf(證件號碼:);puts(roomi-1.ID);printf(房間類型:);if(i=40)printf(單人間n);printf(單價:148元/天,8元/小時。n);elseprint

31、f(雙人間n);printf(單價:128元/天,7元/小時。n);printf(計費方式:);if(roomi-1.flag=1)printf(按小時計費n);elseprintf(按天計費n);printf(入住時間:);printf(%d年%d%月%d日%d時n,roomi-1.t0.year,roomi-1.t0.mon,roomi-1.t0.date,roomi-1.t0.hour);printf(已入住時間:%d年%d月%d天%d小時。n,year1,month1,day1,hour1);printf(押金數(shù)額:);printf(%ld元,roomi-1.deposit);if(r

32、oomi-1.t0.mon!=month)for(k=roomi-1.t0.mon+1;kmonth;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon-1-roomi-1.t0.date+date;elseday+=date-roomi-1.t0.date;hr=hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計費方式計算費用*/if(hr0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i=40)price=8*total_hour;elseprice=7*to

33、tal_hour;if(roomi-1.flag=2)while(hr0)day=day-1;hr=hr+24;if(hr8)total_day=day;elsetotal_day=day+1;if(i=40)price=148*total_day;elseprice=128*total_day;printf(n當前費用為:%ld元.n,price); /*輸出當前費用*/day=0;hr=0; /*時間清零*/ choice();/*保存信息函數(shù)*/void save(int x)int i;char c;FILE *fp;if(fp=fopen(酒店房間登記與計費管理系統(tǒng)信息存儲文件.tx

34、t,wb+)=NULL)printf(無法打開文件。nnn);printf(請按任意鍵返回主菜單,并選擇“退出系統(tǒng)”選項,在修改錯誤后再運行此系統(tǒng)。nn);scanf(%s,&c);main();for(i=1;i=x;i+) if(fwrite(&roomi-1,sizeof(struct room),1,fp)!=1) printf(文件寫入錯誤!nn); fclose(fp);/*讀取信息函數(shù)*/void read(int y)int i=1;char c;FILE *fp;if(fp=fopen(酒店房間登記與計費管理系統(tǒng)信息存儲文件.txt,rb+)=NULL)printf(nn無法打開文件。nnn);printf(請按任意鍵返回主菜單,并選擇“退出系統(tǒng)”選項,在修改錯誤后再運行此系統(tǒng)。nn);scanf(%s,&c);main();elsedofread(&roomi-1,sizeof(struct room),1,fp);i+;while(feof(fp)=0);fclose(fp);第 17 頁

展開閱讀全文
溫馨提示:
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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關資源

更多
正為您匹配相似的精品文檔
關于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!