c语言酒店房间等级与消费系统-C语言编写酒店管理系统

admin2年前酒店大全36
󦘖

微信号

KTV115116

添加微信

本文目录一览:

C语言编写酒店管理系统

int CheckRoom(struct room *pr)

{char phonenu[4][12]={"110","119","120","122"};/*非法私人电话号码*/

char type[3][2]={"2","t","T"};

int flag=1,i;

static int pass=1;

if(NULL==pr) {printf("Error:Null point! Can't check the datas:\n");return 0;}

printf("Start to part Maintain:about room\n");

while( strlen(pr-roomnu)5 )/*检查数据长度,防止保存二进制数据错误*/

{pr-roomnu[5]=0;

printf("ERROR:the roomnu: %s is longer than 5 bytes.\n",pr-roomnu);

printf("Please select another shorter roomnu:\n");

scanf("%s",pr-roomnu);

}

while( strlen(pr-cleaner)19 )/*检查数据长度,防止保存二进制数据错误*/

{pr-cleaner[19]=0;

printf("ERROR:the cleaner:%s is longer than 19 bytes.\n",pr-cleaner);

printf("Please select another shorter name:\n");

scanf("%s",pr-cleaner);

}

while(flag||strlen(pr-phonenu)11)/*检查数据内容(由flag控制)和长度,防止保存二进制数据错误*/

{

while( strlen(pr-phonenu)11 )/*检查长度*/

{pr-phonenu[11]=0;

printf("ERROR:the phonenu:%s is longer than 11 bytes.\n",pr-phonenu);

printf("Please select another shorter phonenu:\n");

scanf("%s",pr-phonenu);

}

while(flag)/*检查内容*//*这个算法也有问题,如果内容非法,但长度通过怎么办呢?*/

{for(i=0;flagi4;i++)

if( 0==strcmp(pr-phonenu,phonenu[i]) )/*内容非法*/

{printf("ERROR:illegal phonenu:%s!\n",pr-phonenu);

flag=0;/*检测到内容非法*/

}

if(flag) flag=0;/*内容检查通过*/

else {flag=1;

printf("Please input a legal phonenu:\n");

scanf("%s",pr-phonenu);/*内容检查未通过,重新收入*/

}

}

}

flag=1;

while(flag||strlen(pr-type)1)/*检查数据内容(由flag控制)和长度,此例和上例不同*/

{

while( strlen(pr-type)1 )/*检查长度*/

{pr-type[1]=0;

printf("ERROR:the type:%s is longer than 1 byte.\n",pr-type);

printf("Please select another shorter type:\n");

scanf("%s",pr-type);

}

while(flag)/*检查内容*/

{if(strcmp(pr-type,type[0])strcmp(pr-type,type[1])strcmp(pr-type,type[2]) )/*内容非法*/

{printf("ERROR:illegal type:%s!\n",pr-type);

flag=0;/*检测到内容非法*/

}

if(flag) flag=0;/*内容检查通过*/

else {flag=1;

printf("Please input a legal type:\n");

scanf("%s",pr-type);/*内容检查未通过,重新收入*/

}

}

}

while( pr-maximumpr-currentclient )/*检查数据间的联系*/

{printf("ERROR:the room's capacity does not fit for the number of current clients.\n");

printf("Please alter the maximum:\n");

scanf("%d",(pr-maximum));

}/*检查房间最大容量和当前已住顾客人数是否相容,如果前者小于后者则写入错误报告文件 */

printf("Congratulations: ROOM Check pass %d!\n",pass++);

return 1;

}

int CheckClient(struct client *pc)

{ int flag=1,i;

char sex[4][2]={"m","M","f","F"};

static int pass=1;

if(NULL==pc) {printf("Error:Null point! Can't check the datas:\n");return 0;}

printf("Start to part Maintain:about client\n");

while( strlen(pc-roomnu)5 )/*检查房间长度*/

{pc-roomnu[5]=0;

printf("ERROR:the roomnu: %s is longer than 5 bytes.\n",pc-roomnu);

printf("Please select another shorter roomnu:\n");

scanf("%s",pc-roomnu);

}

while( strlen(pc-identity_card)!=18 )/*检查身份证号长度*/

{pc-identity_card[18]=0;

printf("ERROR:the identity_card:%s is not 18 bytes.\n",pc-identity_card);

printf("Please check the length and input it again:\n");

scanf("%s",pc-identity_card);

}

while(strlen(pc-name)19)/*检查姓名长度*/

{pc-name[19]=0;

printf("ERROR:the name:%s is longer than 19 bytes.\n",pc-name);

printf("Please select another shorter phonenu:\n");

scanf("%s",pc-name);

}

while(flag||strlen(pc-sex)1)/*检查性别内容(由flag控制)和长度*/

{

while( strlen(pc-sex)1 )/*检查长度*/

{pc-sex[1]=0;

printf("ERROR:the sex:%s is longer than 1 byte.\n",pc-sex);

printf("Please select another shorter sex:\n");

scanf("%s",pc-sex);

}

while(flag)/*检查内容*/

{if(strcmp(pc-sex,sex[0])strcmp(pc-sex,sex[1])strcmp(pc-sex,sex[2])strcmp(pc-sex,sex[3]) )/*内容非法*/

{printf("ERROR:illegal sex:%s!\n",pc-sex);

flag=0;/*检测到内容非法*/

}

if(flag) flag=0;/*内容检查通过*/

else {flag=1;

printf("Please input a legal sex:\n");

scanf("%s",pc-sex);/*内容检查未通过,重新收入*/

}

}

}

while( strlen(pc-date)!=8 )/*检查日期长度*/

{pc-date[8]=0;

printf("ERROR:the date:%s is not 8 bytes.\n",pc-date);

printf("Please check the length and input it again:\n");

scanf("%s",pc-date);

}

while( strlen(pc-collect)5 )/*检查收款人长度*/

{pc-collect[5]=0;

printf("ERROR:the collect:%s is not 5 bytes.\n",pc-collect);

printf("Please check the length and input it again:\n");

scanf("%s",pc-collect);

}

while(pc-time0)/*检查入住天数*/

{printf("ERROR:illegal input of time: %f!\n",pc-time);

printf("Please check and input it again:\n");

scanf("%f",pc-time);

}

while(pc-cost0)/*检查应缴费用*/

{printf("ERROR:illegal input of cost: %f!\n",pc-cost);

printf("Please check and input it again:\n");

scanf("%f",pc-cost);

}

while(pc-fee0)/*检查实缴费用*/

{printf("ERROR:illegal input of cost: %f!\n",pc-fee);

printf("Please check and input it again:\n");

scanf("%f",pc-fee);

}

if( pc-feepc-cost )/*检查数据间的联系,实缴费用应小于应缴用*/

{printf("It may be a error:fee=%f cost=%f\n",pc-fee,pc-cost);

printf("Do you like to alter them?(1:YES;0:NO)\n");

scanf("%d",flag);

while(flag)

{printf("Please input the values:cost and fee\n");

scanf("%f%f",pc-cost,pc-fee);

if(pc-feepc-cost)

{printf("Error again!!\n");flag=1;}

else flag=0;

}

}

printf("Congratulations: CLIENT Check pass %d!\n",pass++);

return 1;

}

int CheckAll(struct room *head_room)

{struct client *pc;

struct room *pr;

if(NULL==head_room) {printf("head_room=0\n");return 0;}

printf("Start to part Maintain:about room and client\n");

pr=head_room;

while(pr)

{CheckRoom(pr);

pc=pr-head;

while(pc)

{CheckClient(pc);

pc=pc-next;

}

pr=pr-next;

}

return 1;

}

/**该函数为内部数据维护,不提供输入数据服务。实体完整性,参照完整性,用户自定义完整性

出现错误则将错误输出到doc文档。

错误范围暂时定义如下:

1.同一房间的客户房间号不同(同房搜索!)

2.实缴费用大于应缴费用。(同房搜索!)

3.同一个客户在同一天两次住进宾馆(全表搜索!身份证号和入住日期相同)

4.同一身份证号,姓名和性别不同(全表搜索!)

另外,应该完成的任务有:

5.计算客户的应缴费用-对cost操作,需要用到:time,unit_price

6.计算客房的总住户人数(包括当前住户)-对totalclient操作,需要用到:没有

7.重新修订当前住户数-对currentclient进行操作,需要用到:time

8.计算客房的总计收入-对income进行操作,需要用到:fee

9.当前住户的实缴费用清零-对fee进行操作,需要用到:time

完成这些操作的先后顺序为:7-6-5-9-8-2-1-3-4*/

int Consistency(struct room *head_room)

{struct room *pr,*tpr;

struct client *pc,*tpc;

char file[12]="error.doc";

int i=0;/*i用于错误计数*/

static int count=0;

FILE *fp;

if(NULL==head_room) {printf("head_room=0\n");return 0;}

printf("Start to part Maintain:Consistency!\n");

pr=head_room;

while(pr)

{pr-currentclient=0;

/*pr-totalclient=0;*/

pr-income=0;

pc=pr-head;

while(pc)

{if(!pc-time) pr-currentclient++;/*完成........7.....*/

/*pr-totalclient++;*/ /*完成........6.....*/

pc-cost=(pc-time)*(pr-unit_price); /*完成........5.....*/

if(!pc-time) pc-fee=0; /*完成........9.....*/

pr-income=pr-income+pc-fee; /*完成........8.....*/

pc=pc-next;

}

pr=pr-next;

}

if(NULL==( fp=fopen(file,"wt") ) )

{printf("Cannot open file:%s!\n",file);

return 0;

}

pr=head_room;

while(pr)

{pc=pr-head;

while(pc)

{if(pc-feepc-cost)

{fprintf(fp,"Error %d:fee=%f cost=%f\n",++i,pc-fee,pc-cost);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

/*完成........2.....*/

}

if( strcmp(pr-roomnu,pc-roomnu) )

{fprintf(fp,"Error %d:the client's roomnu:%s != the room's roomnu:%s",++i,pc-roomnu,pr-roomnu);

fprintf(fp,"roomnu cleaner phonenu type max area price clientNO\n");

fprintf(fp,"%-6s %-16s %-12s %-4s %-3d %-6.1f %-6.1f %-2d\n",pr-roomnu,pr-cleaner,pr-phonenu,pr-type,pr-maximum,pr-area,pr-unit_price,pr-currentclient);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

/*完成........1.....*/

}

pc=pc-next;

}

pr=pr-next;

}

/*这个要全表搜索,搜索一次全表过掉一个客户*/

pr=head_room;

while(pr)

{pc=pr-head;

while(pc)

{

if(pc-next)

{tpc=pc-next;

while(tpc)

{if(0==strcmp(pc-identity_card,tpc-identity_card) 0==strcmp(pc-date,tpc-date) )

{fprintf(fp,"Error %d:the same client:%s lived in our hotel in the same day:%s\n",++i,pc-identity_card,pc-date);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........3.....*/

if(0==strcmp(pc-identity_card,tpc-identity_card) (strcmp(pc-name,tpc-name)||strcmp(pc-sex,tpc-sex)) )

{fprintf(fp,"Error %d:the same client:%s have the different name or sex in our hotel.\n",++i,pc-identity_card);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........4.....*/

tpc=tpc-next;

}/*while(tpc) exit */

/*当前房间比较结束,进入下一个房间*/

tpr=pr-next;

while(tpr)

{tpc=tpr-head;

while(tpc)

{if(0==strcmp(pc-identity_card,tpc-identity_card) 0==strcmp(pc-date,tpc-date) )

{fprintf(fp,"Error %d:the same client:%s lived in our hotel in the same day:%s\n",++i,pc-identity_card,pc-date);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........3.....*/

if(0==strcmp(pc-identity_card,tpc-identity_card) (strcmp(pc-name,tpc-name)||strcmp(pc-sex,tpc-sex)) )

{fprintf(fp,"Error %d:the same client:%s have the different name or sex in our hotel.\n",++i,pc-identity_card);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........4.....*/

tpc=tpc-next;

}/*while(tpc) exit */

tpr=tpr-next;

}/*while(tpr) exit */

}

else/*当前客户下一节点为空的情况搜索*/

{tpr=pr-next;

while(tpr)

{tpc=tpr-head;

while(tpc)

{if(0==strcmp(pc-identity_card,tpc-identity_card) 0==strcmp(pc-date,tpc-date) )

{fprintf(fp,"Error %d:the same client:%s lived in our hotel in the same day:%s\n",++i,pc-identity_card,pc-date);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........3.....*/

if(0==strcmp(pc-identity_card,tpc-identity_card) (strcmp(pc-name,tpc-name)||strcmp(pc-sex,tpc-sex)) )

{fprintf(fp,"Error %d:the same client:%s have the different name or sex in our hotel.\n",++i,pc-identity_card);

fprintf(fp,"roomnu identity_card name sex date clt time cost fee\n");

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n",pc-roomnu,pc-identity_card,pc-name,pc-sex,pc-date,pc-collect,pc-time,pc-cost,pc-fee);

fprintf(fp,"%-6s %-18s %-15s %-3s %-8s %-3s %-4.1f %-5.1f %-5.1f\n\n",tpc-roomnu,tpc-identity_card,tpc-name,tpc-sex,tpc-date,tpc-collect,tpc-time,tpc-cost,tpc-fee);

}/*完成........4.....*/

tpc=tpc-next;

}/*while(tpc) exit */

tpr=tpr-next;

}/*while(tpr) exit */

}

pc=pc-next;/*搜索一次全表过掉一个客户*/

}/*while(pc) exit */

pr=pr-next;

}/*while(pr) exit */

printf("Maintain NO. %d\n",++count);

fclose(fp);

return 1;

}

int ToDate(char *date,int year,int month,int day)/*将年月日转换为字符串*/

{int i,j;

char temp[9];

for(i=3;i-1;i--)

{j=year%10;

temp[i]=j+'0';

year=year/10;

}

for(i=1;i-1;i--)

{j=month%10;

temp[4+i]=j+'0';

month=month/10;

}

for(i=1;i-1;i--)

{j=day%10;

temp[6+i]=j+'0';

day=day/10;

}

temp[8]=0;

strcpy(date,temp);

return 1;

}

int Account(struct room *head_room)

{struct room *pr;

struct client *pc;

char temp[20],date[9],name[6];

float cost,fee;

int time,year,month,day;

int flag=1;

clr();

if(NULL==head_room) {printf("head_room=0\n");getch();clr();return 0;}

printf("Please input CLIENT ID(18bytes)!\n");/*mode=1表示根据身份证号查找特定客户*/

scanf("%s",temp);

while(strlen(temp)!=18)

{printf("Error:the client(ID=%s) is not 18 bytes!",temp);

printf("Please check and input CLIENT ID(18bytes),again!\n");/*mode=1表示根据身份证号查找特定客户*/

scanf("%s",temp);

}

/*查找客户*/

pr=head_room;

flag=1;

while(flagpr)

{pc=pr-head;

while(flagpc)

{if( !strcmp(pc-identity_card,temp)!pc-time)

{printf("roomnu identity_card name sex date clt time cost fee\n");

PrintClient(pc);

flag=0;

}

if(flag) pc=pc-next;

}

pr=pr-next;

}

if(NULL==pc) {printf("Error:the client(ID=%s) does not exist in out hotel!\n",temp);getch();clr();return 0;}

/*获取日期*/

year =GetTime(0,1);

month=GetTime(0,2);

day =GetTime(0,3);

ToDate(date,year,month,day);

time=CountDays(pc-date,date);

cost=time*pr-unit_price;

printf("The client ID=%s who have lived %d days should pay %6.1f $!\n",temp,time,cost);

printf("Please input how much you get from him and your name!\n");

printf("The money is:");

scanf("%f",fee);

printf("Your name(collect) is:");

scanf("%s",name);

while(strlen(name)5)

{printf("Error:the name=%s is longer than 5 bytes!",name);

printf("Please check and input ,again!\n");/*mode=1表示根据身份证号查找特定客户*/

scanf("%s",name);

}

pc-fee=fee;

pc-cost=cost;

pc-time=time;

strcpy(pc-collect,name);

printf("Account end! Thank you!\n");

return 1;

}

C语言客房管理系统,求大神

 //in head.h 

#include"stdio.h"

#include"string.h"

#include"stdlib.h"

#include "ctype.h"

#define MaxRoom 20 

struct guest_info

{

 char name[8]; 

 char fee[5];

 char idnum[18];

 char time[14];

 char outtime[14];

 int number;

 char tel[11];

 int r; 

}room[21];

void Login();

void Search();

void Change();

void out();

void save();

void load();

//in login.c

#include"head.h"

void Login()

{

 int i;

 system("cls");

 printf("请输入客房号:\n");

 scanf("%d",i);

  if(room[i].r==1)

 {

  printf("对不起,该房间已入住");

  return;

 }

 room[i].number=i;

 room[i].r=1;

 printf("请输入客户姓名、身份证号码、联系电话、入住时间、退房时间、费用:\n");

 scanf("%s%s%s%s%s%s",room[i].name,room[i].idnum,room[i].tel,room[i].time,room[i].outtime,room[i].fee);

 save();

 printf("恭喜,登记成功!!\n");

void save()

{

 int i;

 FILE *fp;

 if((fp=fopen("room.txt","wb"))==NULL)

 {

  printf("无法打开文件\n");

  return;

 }

 for(i=0;iMaxRoom;i++)

  if(fwrite(room[i],sizeof(struct guest_info),1,fp)!=1)

   printf("文件读取错误\n");

  printf("文件写入完成\n");

  fclose(fp);

}

void load()

{

 FILE *fp;

 int i;

 if((fp=fopen("room.txt","rb"))==NULL)

 {

  printf("不能打开文件\n");

  return;

 }

 for(i=0;iMaxRoom;i++)

  if(fread(room[i],sizeof(struct guest_info),1,fp)!=1)

  {

   if(feof(fp))

   {

    fclose(fp);

    return;

   }

  printf("文件读取错误\n");

  }

  fclose(fp);

  system("cls");

  printf("文件读取成功\n");

}

void Change()

{

 int i;

 system("cls");

 printf("请输入房间号:\n");

 scanf("%d",i);

 if(room[i].number==i)

 {

  printf("请输入退房日期:\n");

  scanf("%s",room[i].outtime);

  printf("请输入费用:\n");

  scanf("%s",room[i].fee);

  system("cls");

  printf("修改成功!!\n");

 }

 else

 {

  system("cls");

  printf("该房间为空房!!\n");

 }

}

void out()

{

 int i;

 printf("请输入房间号:\n");

 scanf("%d",i);

 if(room[i].number==i)

 {

  room[i]=room[21];

  save();

  system("cls");

  printf("退房成功\n");

 }

 else

 {

  system("cls");

  printf("该房间为空房\n");

 }

}

void Search()

{

 int i;

 system("cls");

 printf("请输入要查询的房间号码:\n");

 scanf("%d",i);

 if(room[i].number==i)

  {

   printf("姓名:%s\n",room[i].name);

   printf("客房号:%d\n",room[i].number);

   printf("联系电话:%s\n",room[i].tel);

   printf("入住时间:%s\n",room[i].time);

   printf("退房时间:%s\n",room[i].outtime);

   printf("费用:%s\n",room[i].fee);

  }

  else

  {

   printf("很抱歉,没有找到该身份证登记的相关信息!!");

  }

}

void FreeRoom()

{

 int f;

 for(f=0;f20;f++)

 {

  if(room[f].r==0)

   printf("%d号房为空房\t",f);

  else

   printf("%d号房已入住\t",f);

 }

}

//in main.c

#include"head.h"

int main()

{

 int i;

 int count=20;

 int j;

 for(j=0;j20;j++)

 {

  room[j].r=0;

 }

 

 do

 {

  printf("\n");

  printf("******************************************************************************\n");

  printf("**************************欢迎使用温馨99客房登记系统**************************\n");

  printf("******************************欢迎员工------1号*******************************\n");

  printf("好消息,特价钟点房40元/2小时,单人房140元/间,双人房230元/间,凭学生证有7折优惠\n");

  printf("\t1.--登记客房信息Insert\n");

  printf("\t2.--查询客房信息Search\n");

  printf("\t3.--修改客房信息Change\n");

  printf("\t4.--用户退房管理Outside\n");

  printf("\t5.--显示当前空房信息Show The Free Romm\n");

  printf("\t6.--把客房信息保存到文件Save The Information into File\n");

  printf("\t7.--从文件记录读取客房信息(维护中)Show The Information from File\n");

  printf("\t8--退出客房管理系统Exit\n");

  printf("****************此程序由舒昱鑫吐血打造Version:1.0 Bate****************\n");

  printf("******************************************************************************\n");

  printf("******************************************************************************\n");

  printf("输入需要选择的功能:");

  scanf("%d",i);

  switch(i)

  {

   case 1:Login();break;

   case 2:Search();break;

   case 3:Change();;break;

   case 4:out();break;

   case 5:FreeRoom();break;

   case 6:save();break;

   case 7:load();break;

   case 8:printf("谢谢使用温馨99的客房登记系统,正在退出..........\n退出成功,按任意键关闭程序!!\n");break;

   default:printf("输入错误,请从新选择");break;

  }

 }

 while(i!=8);

 return 0;

}

请高手帮忙用C语言做一个酒店管理系统

在这个经济社会里谁还会免费c语言酒店房间等级与消费系统的帮人家出这么大的力啊c语言酒店房间等级与消费系统c语言酒店房间等级与消费系统你那酒店管理系统要求再简单也要花时间啊!再说c语言酒店房间等级与消费系统你要它的原理c语言酒店房间等级与消费系统,这不是要人家的知识产权吗?也许人家开发出来把软件打包给你还有可能。

请哪位高手帮我用C语言编一个酒店管理系统软件 ! 急!!!

#define NULL 0

#define LEN sizeof(struct customer)

#include "string.h"

struct customer

{

int num;

char name[20];

long date;

struct customer *next;

}cus;

struct customer *creat(void) /*建立一个链表*/

{

struct customer *head,*p1,*p2;

int n=0;

p1=(struct customer *)malloc(LEN);

p2=(struct customer *)malloc(LEN);

printf("请输入客户的信息:\n");

printf("\n房间:");

scanf("%d",p1-num);

printf("\n");

printf("姓名:");

scanf("%s",p1-name);

printf("\n");

printf("入住时间:");

scanf("%ld",p1-date);

printf("\n");

head=NULL;

while(p1-num!=0)

{

n++;

if(n==1)

head=p1;

else

p2-next=p1;

p2=p1;

p1=(struct customer *)malloc(LEN);

printf("请输入客户的信息:\n");

printf("\n房间:");

scanf("%d",p1-num);

printf("\n");

printf("姓名:");

scanf("%s",p1-name);

printf("\n");

printf("入住时间:");

scanf("%ld",p1-date);

printf("\n");

}

p2-next=NULL;

return(head);

}

struct customer *insert(struct customer *head,struct customer *consumer) /*登记新入住的客户的信息*/

{

struct customer *p1,*p2;

p1=head;

p2=consumer;

if(p1-next!=NULL)

p1=p1-next;

if(p1-next==NULL)

{

p1-next=p2;

p2-next=NULL;

}

return(head);

}

struct customer *del(struct customer *head,int num) /*显示退房客户的信息*/

{

struct customer *p1,*p2;

if(head==NULL)

{

printf("没有客户的信息\n");

return(head);

}

p1=head;

while(num!=p1-nump1-next!=NULL)

{

p2=p1;p1=p1-next;

}

if(num==p1-num)

{

if(p1==head)

head=p1-next;

else

p2-next=p1-next;

printf("退房客户的信息:\n");

printf("客房:%d\n",p1-num);

printf("姓名:%s\n",p1-name);

printf("入住时间:%ld\n",p1-date);

}

else

printf("没有该客户的信息\n");

return(head);

}

struct customer *search(struct customer *head,char c_name[]) /*查询客户信息*/

{

struct customer *p;

p=head;

while(strcmp(p-name,c_name)p-next!=NULL)

p=p-next;

if(p-name==c_name)

{

printf("该客户的信息为:\n");

printf("房间:%d\n姓名:%S\n入住时间:%ld",p-num,p-name,p-date);

}

if(p-name!=c_namep-next==NULL)

printf("没有该客户的信息!\n");

}

void print(struct customer *head) /*打印出现有客户的信息*/

{

struct customer *p;

printf("\n现有客户信息为:\n");

p=head;

if(head!=NULL)

do

{

printf("客房:%d\n",p-num);

printf("姓名:%s\n",p-name);

printf("入住时间:%ld\n",p-date);

p=p-next;

}while(p!=NULL);

}

main()

{

struct customer *head,*p;

int m,number;

char c_name[20];

printf("\n");

printf(" ******************************\n");

printf(" 欢迎进入旅游信息管理系统\n");

printf(" ******************************\n");

printf(" ******************************\n\n");

printf(" 1:建库\n");

printf(" 2:登记\n");

printf(" 3:退房\n");

printf(" 4:查询\n");

printf(" ******************************\n\n");

printf("请执行操作:\n");

scanf("%d",m);

if(m==1)

head=creat();

else

if(m==2)

{

printf("请输入要登记得客户的信息:");

p=(struct customer *)malloc(LEN);

scanf("%d %s %ld",p-num,p-name,p-date);

head=insert(head,p);

print(head);

}

else

if(m==3)

{

printf("请输入要退房的客户的房间号:");

scanf("%d",number);

head=del(head,number);

print(head);

}

else

if(m==4)

{

printf("请输入要查询的客户的姓名:");

scanf("%s",c_name);

search(head,c_name);

}

else

printf("执行操作错误!");

}

有5个警告而已,不过已经很不错了

C语言程序设计 酒店管理 急急急急 求编程高手

我有一部分,给你一点启发!

#includestdio.h

void xx();

void search();

main()

{ int f;

printf(" ▲***********************▲\n");

printf(" △ 欢迎来到XXX饭店△\n");

printf(" ▲************************▲\n");

printf("1.进入. 2退出.\n");

scanf("%d",f);

if(f==1)

search();

else

printf("输入错误");

}

void search()

{

int d[15],g[3],a,b,c,x,y,h;

printf("请选择您需要的号码:\n1.预定房间\n2.退定房间\n");

scanf("%d",a);

if(a3 || a1)

{printf("您输入有误请您重试!\n");

}

else switch(a)

{ case 1:

{ printf("请您输入您的身份证号码\n");

scanf("%d",d[15]);

printf("您已登陆成功^-^\n");

printf("请您选择退定种类:\n");

printf("1.单人间/夜150元\n2.双人间/夜200元\n3.标准间/夜300元\n4.总统套房/夜600元\n");

scanf("%d",b);

switch(b)

{ case 1:printf("请输入预定天数\n");

scanf("%d",x);

printf("请预交款为%d元\n",x*150);

printf("1.确定 2.返回");

scanf("%d",h);

printf("您已预定成功★房间号码为202.\n");break;

case 2:printf("请输入预定天数\n");

scanf("%d",x);

printf("请预交款为%d元\n",x*200);

printf("1.确定 2.返回");

scanf("%d",h);

printf("您已预定成功★房间号码为305.\n");break;

case 3:printf("请输入预定天数\n");

scanf("%d",x);

printf("请预交款为%d元\n",x*300);

printf("1.确定 2.返回");

scanf("%d",h);

printf("您已预定成功★房间号码为208.\n");break;

case 4:printf("请输入预定天数\n");

scanf("%d",x);

printf("请预交款为%d元\n",x*600);

printf("1.确定 2.返回");

scanf("%d",h);

printf("您已预定成功★房间号码为306.\n");break;

default :printf("您的输入有错请您重试");

}

}break;

case 2:

{printf("请您输入您的身份证号码\n");

scanf("%d",d[15]);

printf("您已登陆成功^-^\n");

printf("请您选择退订服务种类:\n");

printf("1.单人间/夜150元\n2.双人间/夜200元\n3.标准间/夜300元\n4.总统套房/夜600元\n");

scanf("%d",c);

switch(c)

{case 1:printf("请您输入要退定的房间号码\n");

scanf("%d",g[3]);

printf("请您输入要退订的天数\n");

scanf("%d",y);

printf("我们将退您%d元\n",y*150);

printf("您退定成功: 谢谢您的光临 !\n");break;

case 2:printf("请您输入要退定的房间号码\n");

scanf("%d",g[3]);

printf("请您输入要退订的天数\n");

scanf("%d",y);

printf("我们将退您%d元\n",y*200);

printf("您退定成功.谢谢您的光临 !");break;

case 3:printf("请您输入要退定的房间号码\n");

scanf("%d",g[3]);

printf("请您输入要退订的天数\n");

scanf("%d",y);

printf("我们将退您%d元\n",y*300);

printf("您退定成功:谢谢您的光临 !\n");break;

case 4:printf("请您输入要退定的房间号码\n");

scanf("%d",g[3]);

printf("请您输入要退订的天数\n");

scanf("%d",y);

printf("我们将退您%d元\n",y*600);

printf("您退定成功:谢谢您的光临 !\n");break;

default:printf("您的输入有错请您重试");}

}break;}

{

int n;

printf("谢谢光顾\n是否要再预定? 1.是2.否");

scanf("%d",n);

if(n==1)

search();

else

printf("再见");

}

}

相关文章

酒店消费者身体风险有哪些-消费者风险包括哪五个类型

酒店消费者身体风险有哪些-消费者风险包括哪五个类型

本文目录一览: 1、消费者风险包括哪五个类型 2、酒店的外部风险有什么 3、酒店风险点有哪些方面 4、消费者在购买中可能遇到的风险有哪几种主要的类型 消费者风险包括哪五个类型 消费者面临...

未来酒店客户消费能力-酒店消费呈现了新趋势,你觉得新趋势怎么样?

未来酒店客户消费能力-酒店消费呈现了新趋势,你觉得新趋势怎么样?

本文目录一览: 1、酒店消费呈现了新趋势,你觉得新趋势怎么样? 2、酒店行业未来的发展趋势是什么? 3、中国酒店业未来五年总体发展趋势 ? 4、未来酒店业发展趋势怎样? 酒店消费呈现了新...

金堂索菲特酒店怎么消费的-连云港索菲特大酒店前台东西贵吗

金堂索菲特酒店怎么消费的-连云港索菲特大酒店前台东西贵吗

本文目录一览: 1、连云港索菲特大酒店前台东西贵吗 2、杭州索菲特西湖大酒店房间内的物品都有哪些收费哪些免费? 3、索菲特宾馆房间里的酒是包括在房费里面?还是另外单独算钱的? 连云港索菲特大...

跨湖楼博学酒店消费怎样-休闲造句-用休闲造句

跨湖楼博学酒店消费怎样-休闲造句-用休闲造句

本文目录一览: 1、休闲造句-用休闲造句 2、有什么和虎有关的地方? 3、泰悦·博学苑怎么样?好不好?值不值得买? 4、跨湖楼博学酒店几星级 休闲造句-用休闲造句 1 猫跨湖楼博学酒店...

广州柏悦酒店悦景轩消费-柏悦酒店会员卡住店打折吗

广州柏悦酒店悦景轩消费-柏悦酒店会员卡住店打折吗

本文目录一览: 1、柏悦酒店会员卡住店打折吗 2、广州两日之行,有哪些餐厅值得一去? 3、柏悦酒店公寓月租多少 4、广州必去十大粤菜餐厅都有哪些? 5、广州最贵的餐厅有哪些? 柏悦酒...

酒店小冰箱消费-天筑豪生酒店小冰箱里的酒水是免费的吗

酒店小冰箱消费-天筑豪生酒店小冰箱里的酒水是免费的吗

本文目录一览: 1、天筑豪生酒店小冰箱里的酒水是免费的吗 2、新密银基冰雪酒店客房里面的小冰箱里面的饮料怎么收费? 3、小冰箱的价格一般都是多少正常? 4、费尔蒙酒店迷你冰箱收费吗 5...

微信号复制成功

打开微信,点击右上角"+"号,添加朋友,粘贴微信号,搜索即可!