客房管理系统C++.docx

上传人:b****8 文档编号:10450879 上传时间:2023-02-11 格式:DOCX 页数:16 大小:20.57KB
下载 相关 举报
客房管理系统C++.docx_第1页
第1页 / 共16页
客房管理系统C++.docx_第2页
第2页 / 共16页
客房管理系统C++.docx_第3页
第3页 / 共16页
客房管理系统C++.docx_第4页
第4页 / 共16页
客房管理系统C++.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

客房管理系统C++.docx

《客房管理系统C++.docx》由会员分享,可在线阅读,更多相关《客房管理系统C++.docx(16页珍藏版)》请在冰豆网上搜索。

客房管理系统C++.docx

客房管理系统C++

功能比较简单,可能不完整,你参考下吧。

是C++的。

建议你去CSDN搜搜,那里程序和论文都挺多的,尤其是用VB的。

#include

h〉

#include

h〉

//***********************************************************************************

voidinitial_room();//初始化80个房间信息

voidwelcome();//验证用户登陆,登陆成功显示欢迎信息

voidenter();

voidbook_room();

voidcheck_in();

voidcheck_out();

voidinquire();

inti=0;

//***********************************************************************************

structRoom

{

intnumber;

intdank;

intprice;

intstate;

};

classCustomer

{

public:

Customer();

voidset_name(char*n){strcpy(name,n);}

voidset_ID(char*p){strcpy(ID,p);}

voidset_room_number(intn){room_number=n;}

voidset_day(intd){day=d;}

voidset_prepaid(intp){prepaid=p;}

char*get_name(){returnname;}

char*get_ID(){returnID;}

intget_room_number(){returnroom_number;}

intget_day(){returnday;}

intget_prepaid(){returnprepaid;}

virtual~Customer();

private:

charname[10],ID[19];

introom_number;

intprepaid;

intchange;

intday;

};

Customer:

Customer()

cout〈<"请您输入顾客的姓名\n”;

cin〉〉name;

cout〈〈"请您输入顾客的身份证号码\n";

cin〉>ID;

prepaid=change=day=0;

}

Customer:

:

~Customer()

{

cout<<"该顾客退房成功!

"<

}

//***********************************************************************************

Roomroom[80];

Customer*customer[80];

voidmain()//程序入口从这里开始运行

{

charchoice='1';

initial_room();//初始化80个房间的信息,分四个等级

welcome();//验证用户登陆,登陆成功显示欢迎信息

while(choice==’1’)

enter();//根据用户的选择执行不同的功能

cout<〈endl;

cout<<”继续使用本系统请按\"1\",退出请按\"2\”!

”;

cin〉>choice;

cout<〈endl;

}

//系统登陆界面***********************************************************************

voidwelcome()//验证用户登陆,登陆成功显示欢迎信息

charname[4],code[7];

cout〈<”请输入用户名和密码(以空格隔开):

\n";

cin〉〉name>〉code;

while((strcmp(name,”000")!

=0)||(strcmp(code,”666666”)!

=0))

{

cout<〈"用户名或密码输入有误,请重新输入!

\n";

cin>>name〉>code;

cout〈〈endl;

cout<

cout<<”▲***************************▲\n”;

cout〈〈”△欢迎使用***系统!

△\n";

cout〈<”▲***************************▲\n”;

cout<

}

//系统入口***************************************************************************

voidenter()

intkind_of_service;

cout〈〈”请选择服务类别:

订房、入住、退房还是查询?

\n";

cout<<”1—>定房2—>入住3—>退房4->查询:

”;

cin〉>kind_of_service;

if((kind_of_service>4)||(kind_of_service<1))

{

cout<<”您的输入有误,请重试!

\n”;

cin〉〉kind_of_service;

}

else

switch(kind_of_service)

{

case1:

book_room();

break;

case2:

check_in();

break;

case3:

check_out();

break;

case4:

inquire();

break;

}

//订房实现***************************************************************************

voidbook_room()

customer[i]=newCustomer;

introom_standard,day;

cout<<"请您选择预定房间的标准:

\n";

cout<<"1.单人间/天150元\n2.双人间/天200元\n3。

标准间/天300元\n4。

总统套房/天600元\n”;

cin〉〉room_standard;

cout〈〈"请输入预定天数\n”;

cin〉>day;

customer[i]-〉set_day(day);

switch(room_standard)

{

intn;

case1:

cout<<”住房费用总共为:

”<

for(n=0;n〈20;n++)//从第一个级别的房间中查找一个空闲的房间

{

if(room[n]。

state==0)//state=0表示该住房没有被预定的

cout<<"预定成功★房间号码为:

”<

room[n]。

state=1;

customer[i]—>set_room_number(room[n]。

number);

break;

}

break;

case2:

cout<〈"住房费用总共为:

”〈〈day*200<<"元\n”;

for(n=20;n<40;n++)

{

if(room[n]。

state==0)

cout<<”预定成功★房间号码为:

”〈

room[n]。

state=1;

customer[i]—>set_room_number(room[n]。

number);

break;

break;

case3:

cout〈〈”住房费用总共为:

"〈〈day*300<〈"元\n”;

for(n=40;n〈60;n++)

{

if(room[n]。

state==0)

{

cout<〈"预定成功★房间号码为:

"〈〈room[n].number〈

room[n].state=1;

customer[i]-〉set_room_number(room[n].number);

break;

break;

case4:

cout<<"住房费用总共为:

”〈

for(n=60;n<80;n++)

{

if(room[n]。

state==0)

cout<〈"预定成功★房间号码为:

”<

number<

room[n]。

state=1;

customer[i]—〉set_room_number(room[n].number);

break;

break;

i++;//住房的顾客数加1

}

//入住登记***************************************************************************

voidcheck_in()

charname1[10],id1[19];

intding_or_no,prepaid;

cout〈〈"该顾客订房了吗?

(1—>订了2-〉没订)";

cin>>ding_or_no;

if(ding_or_no==1)

{

cout〈〈"请输入顾客的姓名:

"〈〈endl;

cin〉>name1;

cout〈<"请输入顾客的身份证号码:

”<

cin〉>id1;

for(intj=0;j〈=i;j++)

if((strcmp(customer[j]—>get_name(),name1)==0)&&(strcmp(customer[j]—〉get_ID(),id1)==0))//查找该顾客的定房信息

intnum=customer[j]->get_room_number();//取得定房的房间号

cout<<”顾客”〈

房间号码为:

"<〈num〈〈endl;

switch(num/100)

case6:

prepaid=customer[j]-〉get_day()*150;

customer[j]—>set_prepaid(prepaid);

cout<<"请收房费"〈

”〈〈endl;//开始收费

room[num%100-1]。

state=2;//修改房间状态为入住状态

break;

case7:

prepaid=customer[j]—〉get_day()*200;

customer[j]-〉set_prepaid(prepaid);

cout〈<”请收房费”〈

"<

room[19+num%100].state=2;

break;

case8:

prepaid=customer[j]—〉get_day()*300;

customer[j]-〉set_prepaid(prepaid);

cout<<”请收房费"〈〈prepaid<<"元整!

"〈

room[39+num%100]。

state=2;

break;

case9:

prepaid=customer[j]—>get_day()*600;

customer[j]—>set_prepaid(prepaid);

cout<<"请收房费"<〈prepaid〈〈”元整!

"〈

room[59+num%100]。

state=2;

break;

}

break;

}

else

customer[i]=newCustomer;

introom_standard,day;

cout<〈”请您选择预定房间的标准:

\n”;

cout<〈”1.单人间/天150元\n2.双人间/天200元\n3.标准间/天300元\n4。

总统套房/天600元\n”;

cin>〉room_standard;

cout〈<"请输入住宿天数\n”;

cin>>day;

customer[i]—>set_day(day);

switch(room_standard)

intn;

case1:

prepaid=day*150;

customer[i]-〉set_prepaid(prepaid);

cout<〈"请收房费"<〈prepaid<<"元整!

\n”;

for(n=0;n<20;n++)

{

if(room[n].state==0)

cout<<"入住房间号码为:

"〈

number<〈endl;

room[n]。

state=2;

customer[i]—>set_room_number(room[n]。

number);

break;

}

break;

case2:

prepaid=day*200;

customer[i]->set_prepaid(prepaid);

cout<<"请收房费”<〈prepaid<<”元整!

\n”;

for(n=20;n〈40;n++)

{

if(room[n]。

state==0)

{

cout<<”入住房间号码为:

"<〈room[n]。

number〈

room[n].state=2;

customer[i]—〉set_room_number(room[n].number);

break;

}

}

break;

case3:

prepaid=day*300;

customer[i]->set_prepaid(prepaid);

cout〈<"请收房费"〈〈prepaid〈<"元整!

\n";

for(n=40;n<60;n++)

{

if(room[n]。

state==0)

cout〈<”入住房间号码为:

"〈

room[n]。

state=2;

customer[i]—>set_room_number(room[n]。

number);

break;

}

}

break;

case4:

prepaid=day*600;

customer[i]—〉set_prepaid(prepaid);

cout<〈”请收房费”<〈prepaid<〈”元整!

\n”;

for(n=60;n<80;n++)

if(room[n].state==0)

cout〈〈”入住房间号码为:

"<

number〈

room[n].state=2;

customer[i]—〉set_room_number(room[n]。

number);

break;

break;

}

i++;

}

//退房结算***************************************************************************

voidcheck_out()

{

charname2[10],id2[19];

intstandard,j,room_number,day1,day2,day;

cout<<”请输入要退房的顾客姓名和身份证号码:

\n";

cin〉>name2>>id2;

cout〈<"请输入该顾客实住天数:

\n”;

cin>〉day2;

for(j=0;j

if((strcmp(customer[j]—〉get_name(),name2)==0)&&(strcmp(customer[j]-〉get_ID(),id2)==0))

{

room_number=customer[j]-〉get_room_number();

standard=room_number/100;

day1=customer[j]-〉get_day();

day=day1—day2;

switch(standard)

case6:

cout<<”顾客的房间号是”〈〈room_number〈<”:

为单人间,每天150元\n";

cout〈<”该顾客预付了房费”<〈customer[j]—>get_prepaid()〈〈”元,实际消费"〈

\n";

cout<〈endl;

if(day>0)

cout〈<"请退给该顾客”<〈day*150〈<”元整!

\n”;

if(day<0)

cout<〈"请补收该顾客住房费”<<—day*150〈〈"元整!

\n”;

break;

case7:

cout<<"顾客的房间号是”〈

为单人间,每天200元\n”;

cout〈<”该顾客预付了房费”<〈customer[j]-〉get_prepaid()〈〈"元,实际消费”<〈day2*200<<”元整!

\n";

cout〈

if(day〉0)

cout〈〈"请退给该顾客”〈〈day*200〈<”元整!

\n";

if(day<0)

cout<〈”请补收该顾客住房费"<〈-day*200<<"元整!

\n”;

break;

case8:

cout〈<”顾客的房间号是”<

为单人间,每天300元\n”;

cout<<”该顾客预付了房费”<get_prepaid()〈<”元,实际消费"〈

\n";

cout〈

if(day>0)

cout〈<"请退给该顾客”〈〈day*300〈<"元整!

\n”;

if(day〈0)

cout〈〈”请补收该顾客住房费”<<-day*300〈〈”元整!

\n”;

break;

case9:

cout<〈”顾客的房间号是”<〈room_number<〈":

为单人间,每天600元\n”;

cout<〈”该顾客预付了房费"〈〈customer[j]->get_prepaid()<<”元,实际消费”<

\n";

cout<〈endl;

if(day>0)

cout〈<"请退给该顾客”〈

\n";

if(day〈0)

cout<〈"请补收该顾客住房费”<<-day*600〈〈"元整!

\n”;

break;

cout〈

cout〈〈"退房核算清楚,请按1:

";

characcount;

cin>〉account;

if(account=='1')

{

for(intk=0;k〈80;k++)

{

if(room[k].number==customer[j]—〉get_room_number())

room[k]。

state=0;

i—-;

for(;j

{

customer[j]=customer[j+1];

deletecustomer[i];

}

}

}

//信息查询***************************************************************************

voidinquire()

{

charinquire_choice;

cout〈<"房间信息查询请按1,顾客信息查询请按2:

"〈〈endl;

cin〉>inquire_choice;

if(inquire_choice==’1’)

intj,k=0;

cout<〈endl;

cout<〈"下列房间还没人预订,也没人入住:

”<

for(j=0;j〈80;j++)

{

if(room[j].state==0)

{

if(k%10==0)cout〈〈endl;

cout<〈room[j].number〈〈'\t’;

k++;

}

cout〈

cout<〈endl;

k=0;

cout<<"下列房间已预订:

”<

for(j=0;j<80;j++)

{

if(room[j].state==1)

{

if(k%10==0)cout〈〈endl;

cout<

number〈〈’\t';

k++;

}

k=0;

cout〈

cout〈

cout<〈”下列房间有人入住:

"〈

for(j=0;j<80;j++)

if(room[j]。

state==2)

if(k%10==0)cout<〈endl;

cout<

number〈〈'\t';

k++;

}

cout〈

cout〈

}

elseif(inquire_choice=='2’)

{

cout<〈”按姓名查询请按1,按身份证查询请按2:

”<

charinquire_choice;

cin>〉inquire_choice;

if(inquire_choice=='1’)

{

charname3[10];

cout<〈”请输入顾客的姓名:

”<〈endl;

cin〉〉name3;

for(intj=0;j〈=i;j++)

if(strcmp(customer[j]—〉get_name(),name3)==0)

cout〈〈name3〈〈”的住房信息如下:

\n”;

cout<〈’\t’〈<"房间号为:

"<〈customer[j]—〉get_room_number()<

cout<<"\t"<〈”预付房费为:

”〈〈customer[j]—>get_prepaid()<〈endl;

if(inquire_choice==’2')

{

charid3[10];

cout〈<"请输入

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

当前位置:首页 > 高等教育 > 管理学

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

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