|
/**************************************************
程序提供: 双鱼林 真实姓名: 汪建林
生日: 1985年2月26日 星座: 双鱼座
血型: 0 家乡: 四川达州
QQ: 287307421 手机:13558690869
***************************************************/
#include<iostream.h>
#include<string.h>
//***********************************************************************************
void initial_room(); //初始化80个房间信息
void welcome(); //验证用户登陆,登陆成功显示欢迎信息
void enter();
void book_room();
void check_in();
void check_out();
void inquire();
int i=0;
//***********************************************************************************
struct Room
{
int number;
int dank;
int price;
int state;
};
class Customer
{
public:
Customer();
void set_name(char *n){strcpy(name,n);}
void set_ID(char *p){strcpy(ID,p);}
void set_room_number(int n){room_number=n;}
void set_day(int d){day=d;}
void set_prepaid(int p){prepaid=p;}
char *get_name(){return name;}
char *get_ID(){return ID;}
int get_room_number(){return room_number;}
int get_day(){return day;}
int get_prepaid(){return prepaid;}
virtual ~Customer();
private:
char name[10],ID[19];
int room_number;
int prepaid;
int change;
int day;
};
Customer::Customer()
{
cout<<"请您输入顾客的姓名\n";
cin>>name;
cout<<"请您输入顾客的身份证号码\n";
cin>>ID;
prepaid=change=day=0;
}
Customer::~Customer()
{
cout<<"该顾客退房成功!"<<endl;
}
//***********************************************************************************
Room room[80];
Customer *customer[80];
void main() //程序入口从这里开始运行
{
char choice='1';
initial_room(); //初始化80个房间的信息,分四个等级
welcome(); //验证用户登陆,登陆成功显示欢迎信息
while(choice=='1')
{
enter(); //根据用户的选择执行不同的功能
cout<<endl;
cout<<"继续使用本系统请按\"1\",退出请按\"2\"! ";
cin>>choice;
cout<<endl;
}
}
//系统登陆界面***********************************************************************
void welcome() //验证用户登陆,登陆成功显示欢迎信息
{
char name[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<<endl;
cout<<" ▲***************************▲\n";
cout<<" △ 欢迎使用***系统!△\n";
cout<<" ▲***************************▲\n";
cout<<endl;
}
//系统入口***************************************************************************
void enter()
{
int kind_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)
{
case 1: book_room();
break;
case 2: check_in();
break;
case 3: check_out();
break;
case 4: inquire();
break;
}
}
//订房实现***************************************************************************
void book_room()
{
customer[i]=new Customer;
int room_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)
{
int n;
case 1:
cout<<"住房费用总共为: "<<day*150<<"元\n"; |
|