您好,欢迎访问三七文档
功能比较简单,可能不完整,你参考下吧。是C++的。建议你去CSDN搜搜,那里程序和论文都挺多的,尤其是用VB的。#includeiostream.h#includestring.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;cinname;cout请您输入顾客的身份证号码\n;cinID;prepaid=change=day=0;}Customer::~Customer(){cout该顾客退房成功!endl;}//***********************************************************************************Roomroom[80];Customer*customer[80];voidmain()//程序入口从这里开始运行{charchoice='1';initial_room();//初始化80个房间的信息,分四个等级welcome();//验证用户登陆,登陆成功显示欢迎信息while(choice=='1'){enter();//根据用户的选择执行不同的功能coutendl;cout继续使用本系统请按\1\,退出请按\2\!;cinchoice;coutendl;}}//系统登陆界面***********************************************************************voidwelcome()//验证用户登陆,登陆成功显示欢迎信息{charname[4],code[7];cout请输入用户名和密码(以空格隔开):\n;cinnamecode;while((strcmp(name,000)!=0)||(strcmp(code,666666)!=0)){cout用户名或密码输入有误,请重新输入!\n;cinnamecode;}coutendl;coutendl;cout▲***************************▲\n;cout△欢迎使用***系统!△\n;cout▲***************************▲\n;coutendl;}//系统入口***************************************************************************voidenter(){intkind_of_service;cout请选择服务类别:订房、入住、退房还是查询?\n;cout1-定房2-入住3-退房4-查询:;cinkind_of_service;if((kind_of_service4)||(kind_of_service1)){cout您的输入有误,请重试!\n;cinkind_of_service;}elseswitch(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;cout1.单人间/天150元\n2.双人间/天200元\n3.标准间/天300元\n4.总统套房/天600元\n;cinroom_standard;cout请输入预定天数\n;cinday;customer[i]-set_day(day);switch(room_standard){intn;case1:cout住房费用总共为:day*150元\n;//计算住房费用for(n=0;n20;n++)//从第一个级别的房间中查找一个空闲的房间{if(room[n].state==0)//state=0表示该住房没有被预定的{cout预定成功★房间号码为:room[n].numberendl;room[n].state=1;customer[i]-set_room_number(room[n].number);break;}}break;case2:cout住房费用总共为:day*200元\n;for(n=20;n40;n++){if(room[n].state==0){cout预定成功★房间号码为:room[n].numberendl;room[n].state=1;customer[i]-set_room_number(room[n].number);break;}}break;case3:cout住房费用总共为:day*300元\n;for(n=40;n60;n++){if(room[n].state==0){cout预定成功★房间号码为:room[n].numberendl;room[n].state=1;customer[i]-set_room_number(room[n].number);break;}}break;case4:cout住房费用总共为:day*600元\n;for(n=60;n80;n++){if(room[n].state==0){cout预定成功★房间号码为:room[n].numberendl;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-没订);cinding_or_no;if(ding_or_no==1){cout请输入顾客的姓名:endl;cinname1;cout请输入顾客的身份证号码:endl;cinid1;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顾客name1今天入住本宾馆!房间号码为:numendl;switch(num/100){case6:prepaid=customer[j]-get_day()*150;customer[j]-set_prepaid(prepaid);cout请收房费prepaid元整!endl;//开始收费room[num%100-1].state=2;//修改房间状态为入住状态break;case7:prepaid=customer[j]-get_day()*200;customer[j]-set_prepaid(prepaid);cout请收房费prepaid元整!endl;room[19+num%100].state=2;break;case8:prepaid=customer[j]-get_day()*300;customer[j]-set_prepaid(prepaid);cout请收房费prepaid元整!endl;room[39+num%100].state=2;break;case9:prepaid=customer[j]-get_day()*600;customer[j]-set_prepaid(prepaid);cout请收房费prepaid元整!endl;room[59+num%100].state=2;break;}break;}}}else{customer[i]=newCustomer;introom_standard,day;cout请您选择预定房间的标准:\n;cout1.单人间/天150元\n2.双人间/天200元\n3.标准间/天300元\n4.总统套房/天600元\n;cinroom_standard;cout请输入住宿天数\n;cinday;customer[i]-set_day(day);switch(room_standard){intn;case1:prepaid=day*150;customer[i]-set_prepaid(prepaid);cout请收房费prepaid元整!\n;for(n=0;n20;n++){if(room[n].state==0){cout入住房间号码为:room[n].numberendl;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;n40;n++){if(room[n].state==0){cout入住房间号码为:room[n].n
本文标题:客房管理系统C++
链接地址:https://www.777doc.com/doc-4048971 .html