C语言程序设计酒店管理系统实验报告.docx

上传人:b****6 文档编号:7017149 上传时间:2023-01-16 格式:DOCX 页数:23 大小:447.72KB
下载 相关 举报
C语言程序设计酒店管理系统实验报告.docx_第1页
第1页 / 共23页
C语言程序设计酒店管理系统实验报告.docx_第2页
第2页 / 共23页
C语言程序设计酒店管理系统实验报告.docx_第3页
第3页 / 共23页
C语言程序设计酒店管理系统实验报告.docx_第4页
第4页 / 共23页
C语言程序设计酒店管理系统实验报告.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

C语言程序设计酒店管理系统实验报告.docx

《C语言程序设计酒店管理系统实验报告.docx》由会员分享,可在线阅读,更多相关《C语言程序设计酒店管理系统实验报告.docx(23页珍藏版)》请在冰豆网上搜索。

C语言程序设计酒店管理系统实验报告.docx

C语言程序设计酒店管理系统实验报告

课程设计报告书

 

题目:

酒店管理系统设计报告

专业:

电子信息工程(移动互联网)

班级:

一班

**********

学号:

************

教师:

朴海光

一:

程序功能

酒店系统管理包括:

主菜单、查看客房入住情况、登记入住、修改客房信息、修改客房信息及退房六个功能模块。

每个功能用一个函数来实现,从而达到功能的模块化。

主菜单模块:

主菜单模块包括1.查看客房入住情况、2.登记入住、3.客房信息修改、4.退房及显示入住的总费用、5.返回主菜单、6.直接退出程序。

1)查看客房入住情况功能模块:

主要功能是查看房间的入住情况和继续查看已入住的房间的客户信息。

2)登记入住功能模块:

采用结构体数组来记录客户的信息,包括姓名、性别、年龄、身份证号、入住时间,入住单价及入住人数,登记完一个房间后可选择继续下一个房间的登记,也可以选择返回主菜单进行其他功能的操作。

3)修改客房信息功能模块:

包括修改客户信息模块和修改房间信息模块。

4)修改客户信息模块:

主要功能是可选择性的修改客户某个信息,也可以一次性全部修改。

5)修改客房信息功能模块:

用来对客户换房时对客户信息和房间号的修改。

实现的功能是只要输入客户以前住的房间号和现在想住的房间号,就将客户的信息全部移到现在想住的房间上,而以前的房间将被置为未使用。

6)退房及显示总费用功能模块:

当客户退房时,将客户使用的客房置为未使用,删除客户信息。

并且显示客户从入住到退房时的总费用。

二:

程序代码

#include

#include

#include

#defineM80

intj,s;

inthj[81]={0};

FILE*fp;//定义文件指针变量

structdate//定义结构体类型

{

intmonth;

intday;

intyear;

}final;

structclient

{charname[20];

intsex;

intage;

charID_card[20];

intcount;

structdatestart;

};

structhotel

{

intprice;

introom_ID;

structclientpersonal;

}room[M];

voidsave();//声明文件函数

voidcheck_siru();//声明查看客房入住情况函数

voidregistration_live();//声明登记入住信息函数

voidmodify_infor();//声明修改客房信息函数

voidamend_one();//声明修改个人信息函数

voidamend_room();//声明修改房间信息函数

voidcost();//声明退房及显示入住费用函数

voidget_back();//声明返回主菜单函数

voidcheck_siru1();//声明查看客房入住情况的调用函数

voidregistration_live1();//声明登记入住信息的调用函数

voidamend_one1();//声明修改个人信息的调用函数

voidamend_room1();//声明修改房间信息的调用函数

voidcost1();//声明显示入住费用的调用函数

intmain()//主函数

{

intmenu();

voidprint_message();

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

print_message();

menu();

save();

return0;

}

voidprint_message()

{

printf("\t\t\t欢迎入住黄金酒店\n\n\n");

}

menu()//主菜单函数

{

intn;

printf("\n");

printf("\t\t\t主菜单\n\n");

printf("\t\t\t按1查看客房入住情况\n");

printf("\t\t\t按2登记入住信息\n");

printf("\t\t\t按3修改客房信息\n");

printf("\t\t\t按4退房、及显示入住费用\n");

printf("\t\t\t按5返回主菜单\n");

printf("\t\t\t按6退出程序\n");

printf("\n\t请输入要进行操作的选项(1、2、3、4、5、6):

");

scanf("%d",&n);

while(n<1||n>6)

{

printf("\t\t\t输入错误,请重新输入选项!

");

scanf("%d",&n);

}

switch(n)

{

case1:

check_siru();break;

case2:

registration_live();break;

case3:

modify_infor();break;

case4:

cost();break;

case5:

get_back();break;

case6:

exit(0);

}

return0;

}

voidcheck_siru()//查看房间使用情况函数

{

inta,g,count=0;

for(g=1;g<=80;g++)

{

if(hj[g]==0)

++count;

else

if(hj[g]==1)

printf("\n\t\t\t正在使用的房间号:

%d",g);

}

printf("\n\n\t\t\t未使用的房间数:

%d",count);

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

printf("\n\n");

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

");

scanf("%d",&s);

if(hj[s]==1)

{

printf("\n\t\t\t姓名:

%s",room[s].personal.name);

printf("\n\t\t\t性别(其中:

1表示男,2表示女!

):

%d",room[s].personal.sex);

printf("\n\t\t\t年龄:

%d",room[s].personal.age);

printf("\n\t\t\t身份证号:

%s",room[s].personal.ID_card);

printf("\n\t\t\t入住年份:

%d",room[s].personal.start.year);

printf("\n\t\t\t月:

%d",room[s].personal.start.month);

printf("\n\t\t\t日:

%d",room[s].personal.start.day);

printf("\n\t\t\t房间号:

%d",room[s].room_ID);

printf("\n\t\t\t客房单价:

%d",room[s].price);

printf("\n\t\t\t入住人数:

%d",room[s].personal.count);

printf("\n\n\t\t\t按1返回主菜单,按2继续\n");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

check_siru1();break;

}

}

else

printf("\n\t\t\t该房间未被使用!

");

}

save();

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

check_siru1();break;

}

}

voidregistration_live()//登记入住函数

{

inta;

printf("\t\t请输入登记的相关信息:

\n");

printf("\n\t\t\t房间号");

scanf("%d",&j);

room[j].room_ID=j;

printf("\n\t\t\t姓名:

");

scanf("%s",room[j].personal.name);

printf("\n\t性别(其中:

1表示男,2表示女!

):

");

scanf("%d",&room[j].personal.sex);

printf("\n\t\t\t年龄:

");

scanf("%d",&room[j].personal.age);

printf("\n\t\t\t身份证号:

");

scanf("%s",room[j].personal.ID_card);

printf("\n\t\t\t入住年份:

");

scanf("%d",&room[j].personal.start.year);

printf("\n\t\t\t月份:

");

scanf("%d",&room[j].personal.start.month);

printf("\n\t\t\t日期:

");

scanf("%d",&room[j].personal.start.day);

printf("\n\t\t\t客房单价:

");

scanf("%d",&room[j].price);

printf("\n\t\t请输入入住人数:

");

scanf("%d",&room[j].personal.count);

hj[j]=1;

save();

printf("\n\n\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

registration_live1();break;

}

}

voidmodify_infor()//修改客房函数

{

intr,m;

printf("\t\t\t菜单\n\n\n");

printf("\t\t\t1:

修改客户信息\n");

printf("\t\t\t2:

修改房间信息\n");

printf("\t\t\t3:

返回主菜单\n");

printf("\t\t\t4:

退出程序\n");

printf("\n\n\t\t请选择输入选项(1、2、3、4):

");

scanf("%d",&m);

if(m<1||m>3)

{

r=1;

}

elser=0;

switch(m)

{

case1:

amend_one1();break;

case2:

amend_room1();break;

case3:

menu();

case4:

exit(0);

}

save();

}

voidamend_one()//修改客人信息函数

{

inti,q;

chara[20];

printf("\n\n\t\t\t请输入现住的房间号:

");

scanf("%d",&j);

printf("\n\t\t\t请选择您要修改的个人选项\n");

printf("\t\t\t1:

代表姓名\n\t\t\t2:

代表性别(其中1表示男,2表示女)\n\t\t\t3:

年龄\n\t\t\t4:

代表身份证号\n\t\t\t5:

代表入住年份\n\t\t\t6:

代表入住月份\n\t\t\t7:

代表入住日期\n\t\t\t8:

入住人数\n");

printf("\t\t\t请选择输入选项(1、2、3、4、5、6、7、8):

");

scanf("%d",&q);

switch(q)

{

intt,p;

case1:

printf("\n\t\t\t请输入新名字:

");

scanf("%s",a);

strcpy(room[j].personal.name,a);

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case2:

printf("\n\t\t请输入新性别(其中:

1表示男,2表示女):

");

scanf("%d",&p);room[j].personal.sex=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case3:

printf("\n\t\t\t请输入年龄:

");

scanf("%d",&p);room[j].personal.age=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case4:

printf("\n\t\t\t请输入新身份证号:

");

scanf("%s",room[j].personal.ID_card);

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case5:

printf("\n\t\t\t请输入新年份:

");

scanf("%d",&p);room[j].personal.start.year=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case6:

printf("\n\t\t\t请输入新月份:

");

scanf("%d",&p);room[j].personal.start.month=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case7:

printf("\n\t\t\t请输入新日期:

");

scanf("%d",&p);room[j].personal.start.day=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

case8:

printf("\n\t\t\t请输入新入住人数:

");

scanf("%d",&p);room[j].personal.count=p;

printf("\n\n\t\t\t按1返回主菜单,按2继续:

");

scanf("%d",&i);

switch(i)

{

case1:

menu();break;

case2:

amend_one1();break;

}

}

menu();

}

voidamend_room()//修改房间信息函数

{

inta,l,x;

printf("\n\t\t\t\t请输入你要修改的客房信息\n\n");

printf("\t\t\t\t1:

房间号\n\n\t\t\t\t2:

客房单价\n\n\t\t\t\t3:

入住人数\n\n\t\t\t\t4:

返回\n\n");

printf("\t\t\t请选择输入选项(1、2、3、4):

");

scanf("%d",&l);

switch(l)

{

case1:

printf("\n\t\t\t请输入旧房号:

");

scanf("%d",&j);

printf("\t\t\t请输入新房号:

");

scanf("%d",&s);

strcpy(room[s].personal.name,room[j].personal.name);

//room[j].personal.name={'\0'};

room[s].personal.sex=room[j].personal.sex;

room[j].personal.sex=0;

room[s].personal.age=room[j].personal.age;

room[j].personal.age=0;

strcpy(room[s].personal.ID_card,room[j].personal.ID_card);

//room[j].personal.ID_card={'\0'};

room[s].personal.start.year=room[j].personal.start.year;

room[j].personal.start.year=0;

room[s].personal.start.month=room[j].personal.start.month;

room[j].personal.start.month=0;

room[s].personal.start.day=room[j].personal.start.day;

room[j].personal.start.day=0;

room[s].room_ID=s;

room[s].price=room[j].price;

room[s].personal.count=room[j].personal.count;

hj[s]=1;

hj[j]=0;

printf("\n\n\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

amend_room1();break;

}

case2:

printf("\n\t\t\t请输入房号:

");

scanf("%d",&s);

printf("\t\t\t请输入新单价:

");

scanf("%d",&x);room[s].price=x;

printf("\n\n\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

amend_room1();break;

}

case3:

printf("\n\t\t\t请输入房号:

");

scanf("%d",&s);

printf("\t\t\t请输入新入住人数:

");

scanf("%d",&x);

room[s].personal.count=x;

printf("\n\n\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

amend_room1();break;

}

case4:

break;

}

save();

menu();

}

voidcost()//退房、显示入住费用函数

{

inta,i,sum;

printf("\t\t\t请输入房间号:

");

scanf("%d",&j);

room[j].room_ID=j;

printf("\n\t\t\t入住年份:

%d",room[j].personal.start.year);

printf("\n\t\t\t月:

%d",room[j].personal.start.month);

printf("\n\t\t\t日:

%d",room[j].personal.start.day);

printf("\n\t\t\t房间单价为:

");

printf("%d",room[j].price);

printf("\n\t\t\t请输入退房时间:

");

printf("\n\t\t\t请输入年份:

");

scanf("%d",&final.year);

printf("\n\t\t\t请输入月份:

");

scanf("%d",&final.month);

printf("\n\t\t\t请输入日期:

");

scanf("%d",&final.day);

printf("\n\t\t\t请输入入住天数:

");

scanf("%d",&i);

sum=room[j].price*i;

printf("\n\t\t\t总费用sum=%d\n",sum);

hj[j]=0;

save();

printf("\n\n\t\t按1返回主菜单,按2继续:

");

scanf("%d",&a);

switch(a)

{

case1:

menu();break;

case2:

cost1();break;

}

}

voidget_back()//返回主菜单的调用函数

{

menu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1