酒店管理系统c语言带注释,酒店管理系统--C语言版.pdf
酒店管理系統...C語言版。
//
#include
#include
#include
#include
//成員變量的聲明
int i,j,k,p 0;
char temp[] "";
int room[5][5];
clock_t start;
//成員方法的聲明
void init()
{
int x,y,z;
for(x 0;x<5;x++)
{
for(y 0;y<5;y++)
{
room[x][y] 0;
}
}
}
void hotelTitle()
{
printf("\n酒店房間登記與計費管理系統\n");
printf("\t1.登記入住\n");
printf("\t2.查詢房間的入住情況\n");
printf("\t3.查詢當前費用\n");
printf("\t4.結賬退房\n");
printf("\t5.退出程序\n");
}
void hotel_execute();
void hotel_select();
void hotel_outhotel();
void outsystem();
void hotel_total();
int main(void)
{
system("color f1");
init();
while(1)
{
Loop:
hotelTitle();
printf("\n請選擇:");
j scanf("%d",&k);
if(j 0||k<1||k>5)
{
printf("\n輸入錯誤。\n\t請輸入所列出的選項。\n\n 3 秒后刷新...Please Weit!
Thanks\n");
fflush(stdin);
sleep(3000);
system("cls");
goto Loop;
}else{
switch(k)
{
case 1:hotel_execute();break;
case 2:hotel_select();break;
case 3:hotel_total();break;
case 4:hotel_outhotel();break;
case 5:outsystem();return;
default:
printf("\n\t系統出錯!請聯系管理員!\n");//怕出現BUG
return;
}
}
fflush(stdin); //清空緩存
}
}
//入住登記
void hotel_execute()
{
int x,y,z;
printf("請輸入你要住本酒店多少層樓的住房? 【1-5】");
fflush(stdin);
L:scanf("%d",&x);
p x;
if(x>5)
{
printf("不好意思本店沒有該層樓房。\n請重新選擇:");
goto L;
}
printf("請輸入你要住第%d層的幾號房間? 【1-5】",x);
fflush(stdin);
LP:scanf("%d",&y);
if(y>5)
{
printf("不好意思該層樓并無該房間。\n請重新選擇:");
goto LP;//無條件的回去 GOTO語句
}
if(x>2){//二層以上則100元一天
printf("\n提示:該房是貴賓套房,100元一天\n");
}else{
printf("\n提示:該房是標準套房,50元一天\n");
}
if(room[x-1][y-1] 0)//判斷該房已經入住
{
room[x-1][y-1] 1;
printf("\n謝謝您的光臨,您已經成功登記。\n您的信息如下:\n入住房
間:%d-%d\n",x,y);
start clock();
超強干貨來襲 云風專訪:近40年碼齡,通宵達旦的技術人生總結
以上是生活随笔為你收集整理的酒店管理系统c语言带注释,酒店管理系统--C语言版.pdf的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux centos删除安装的包,C
- 下一篇: c 语言登录系统源代码,c语言源代码--