酒店管理系统...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("\\n");
printf("\\n");
printf("\\n");
printf("\\n");
printf("\\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();
}
else
{
printf("警告:该房已经有人入住...请换房入住哈。\n");
}
}
//查询住房信息
void hotel_select()
{
int x,y,z;
system("cls");//清空内容。
//以下没什么重要的。就是控制输出格式
printf("宾馆入住情
酒店管理系统 C语言版 来自淘豆网www.taodocs.com转载请标明出处.