Traditional Culture Encyclopedia - Hotel reservation - C语言实现酒店信息管理系统
C语言实现酒店信息管理系统
不知道你的要求是什么,把我以前的关于酒店管理的代码发给你参考下吧. include #包含& ltstring.h & gt?# include & ltstdlib.h & gt# include & ltstdio.h & gt?# include & ltconio.h & gt?typedef?struct?标签客户{ char?m _ ID[19];?/*身份证号码*/ char?m _ name[1];/*顾客姓名*/ int?m _年龄;/*顾客年龄*/ char?m _ sex[6];/*顾客性别*/ int?num
}客户;/*顾客结构*/
typedef?struct?tagRoom
{ int?m _ num?/*房间号*/ int?m _ floor/*楼层*/ int?m _ price/*价格*/ int?m _ use?/*是否已入住*/
}房间;/*房间结构*/
int?I,j=,年龄,num,楼层,价格,用途,n;
int?雷吉?=;
客户cus[5];
Roomr[5];
int?计数= 5;
字符?ID[18],姓名[1],性别[6];文件?* fproom文件?* fpcustomer
作废?customer _ Input(){ if(count & lt;=5) {
printf("请输入身份证号(18位数字):");scanf("%s ",& ampcus[j]。m _ ID);
printf("请输入姓名(1位字符)");scanf("%s ",& ampcus[j]。m _ name);
printf("请输入年龄(数字型)");scanf("%d ",& ampcus[j]。m _ age);
printf("请输入性别(男或女):");scanf("%s ",& ampcus[j]。m _ sex);} else {
printf("\n?存储空间已满!");} printf("\n\r顾客可以住在:");printf("\n\r房间号楼层价格是否空闲(1:空闲:已使用)");for(I = ;我& lt数数;i++) {
if(r[i].m_use==1)
{ printf("\n\r%d?%d%d%d,",r[i]。m_num,r[i]。m_floor,r[i]。m_price,r[i]。m _ use);
} } printf("\n\r请你输入房间号:");scanf("%d ",& ampnum);雷吉?=?;for(I = ;我& lt数数;i++) {
if(r[i].m _ use = = 1 & amp& ampr[i]。m_num==num)
{ r[i]。m_use?=?;printf("\n?登记成功!\ n ");cus[j]。num=r[i]。m_num?;j = j+1;reg = 1;} } if(reg==) {
printf("\n?登记失败!\ n ");}
}
作废?customer _ list out()
{ if(count & lt;=5) {
printf("请输入身份证号(18位数字):");scanf("%s ",& ampID);
for(I = ;我& lt数数;i++)
{ if(strcmp(cus[i].m_ID,ID)==) {
printf("\n\r顾客身份证号:%s姓名:%s年龄:%d性别:%s?\n ",cus[i]。m_ID,cus[i]。m_name,cus[i]。年龄,cus[i]。m _ sex);} } else {
printf("\n?\ n ");}
}
作废?Room_ListOut()
{ printf("\n\r房间号楼层价格是否空闲(1:空闲:已使用)");for(I = ;我& lt数数;i++) {
if(r[i].m_use==1)
{ printf("\n\r%d?%d%d%d,",r[i]。m_num,r[i]。m_floor,r[i]。m_price,r[i]。m _ use);作废?per customer _ Search()
{ if(count & lt;=5) {
printf("请输入身份证号(18位数字):");scanf("%s ",& ampcus[j]。m _ ID);
printf("请输入姓名(1位字符)");scanf("%s ",& ampcus[j]。m _ name);
printf("请输入年龄(数字型)");scanf("%d ",& ampcus[j]。m _ age);
printf("请输入性别(男或女):");scanf("%s ",& ampcus[j]。m _ sex);} else {
printf("\n?住房已满!");} printf("\n\r顾客可以预订:");printf("\n\r房间号楼层价格是否空闲(1:空闲:已使用)");for(I = ;我& lt数数;i++) {
if(r[i].m_use==1)
{ printf("\n\r%d?%d%d%d,",r[i]。m_num,r[i]。m_floor,r[i]。m_price,r[i]。m _ use);
} } printf("\n?请你输入要预订的房间号:");scanf("%d ",& ampnum);雷吉?=?;for(I = ;我& lt数数;i++) {
if(r[i].m _ use = = 1 & amp& ampr[i]。m_num==num)
{ r[i]。m_use?=?;printf("\n?预订成功!\ n ");cus[j]。num=r[i]。m_num?;j = j+1;reg = 1;} } if(reg==) {
printf("\n?预订失败!\ n ");}
}
作废?UnCustomer_Out()
{ int?k;printf("\n?请输入要退房顾客身份证:");scanf("%s ",& ampID);
for(I = ;我& lt数数;i++)
{ if(strcmp(cus[i].m_ID,ID)==) {
printf("\n\r顾客身份证号:%s姓名:%s年龄:%d性别:%s?\n\r已经成功退房!",cus[i]。m_ID,cus[i]。m_name,cus[i]。年龄,cus[i]。m _ sex);
for(k = ;k & lt数数;k++) if(r[k]。m_num==cus[i]。num)
r[k]。m _ use = 1;memset(& amp;cus[i],,sizeof(客户));}
}
}
作废?customer _ go away()
{ FP room = fopen(" room "," w b+ ");fwrite((void?*)& amp;r,sizeof(Room),count,FP Room);fclose(FP room);fpcustomer=fopen("customer "," w b+ ");fwrite((void?*)& amp;r,sizeof(房间),count,FP customer);fclose(FP customer);退出();}
main()
{ FP room = fopen(" room "," WB ");if(fproom!= NULL){
for(I = ;我& lt数数;i++)
{ int?id = 1r[i]。m _ num = I+1;r[i]。m _ floor = 1;r[i]。m _ price = 1r[i]。m _ use = 1;
}
fwrite((void?*)& amp;r,sizeof(Room),count,FP Room);
f close(FP room);} else {
printf("\n -文件打开失败 - ");} for(;;){
printf(" \ n ");
printf("/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ \ \ n ");
printf("*?* \ n ");
printf("*酒店管理系统* \ n ");
printf("*?主菜单?* \ n ");
printf("*?* \ n ");
printf("*1。顾客登记* \ n ");
printf("*2。查询顾客信息* \ n ");
printf("*3。查询空房间?* \ n ");
printf("*4。预订房间* \ n ");
printf("*5。退订房间* \ n ");
printf("*6。保存并退出系统?* \ n ");?
printf("*?* \ n ");
printf(" \ \ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\ n \ n ");
printf("请输入选择项(1-6):");scanf("%d ",& ampn);
printf(" \ n \ n \ n \ n ");
如果(n & gt & amp& ampn & lt=6)
{开关(n) {大小写?1:客户_输入();打破;案子?2:Customer _ list out();打破;/*查询顾客信息*/案例?3:Room _ list out();打破;/*查询空房间*/案例?4:per customer _ Search();打破;/*预订房间*/案例?5:un customer _ Out();打破;/*退订房间*/案例?6:Customer _ go away();?/*保存退出*/ }
}
其他?
{ printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *);printf("*?* \ n ");printf("*?输入错误!* \ n ");printf("*?请退出!?* \ n ");printf("*?* \ n ");printf(" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");打破;
} }
}
- Previous article:Beijing Dongsi Hotel Price Information
- Next article:Theme Hotel Types of Theme Hotels
- Related articles
- Where to see cherry blossoms in Changsha? The best place to see cherry blossoms in Changsha
- How many kilometers is it from Nanchang Caida Shopping Plaza to Wentang Town, Yichun City?
- Hailaer Airport Where is Hailar Airport?
- How to clean the dust and lice on the bed?
- Introduction of Shanghai Chief Building Hotel
- What clothes to buy when traveling to Thailand and what clothes to bring when traveling to Thailand?
- How far is Li Hong Semiconductor in Hua Hong, Shanghai from the center of Shanghai?
- How about Changsha Mars Myth E-sports Hotel?
- How can Huizhou Danshui get to the first floor of Dalong Daxia Phase II, No.2, No.1 Culture Road, Jiangbei?
- How to pay for Hyatt Regency Sanya Center?