Hotel类初始化酒店各层与各个房间
Hotel::Hotel(void)
{
floor = 4;
// 定义记录每层房间数量的数组
room_cnt = new uint8_t[8];
rooms = new Room*[floor];
for(int i=0; i<floor; i++)
{
room_cnt[i] = 8;
rooms[i] = new Room[room_cnt[i]];
for(int j=0; j<room_cnt[i]; j++)
{
rooms[i][j].set_id((i+1)*100+j+1);
rooms[i][j].set_type(RoomType(i+1));
rooms[i][j].set_price((i+1)*100);
}
}
}
入住
void HotelManage::in(void)
{
cout << "请选择要入住的型号1/2/3/4" << endl;
int num;
cin >> num;
RoomType type = RoomType(num);
for(int j=0;j<8;j++)
{
if(0==hotel->rooms[num][j].cnt)
{
cout << "请输入你的身份证号和姓名" <<endl;
string name;
uint32_t id;
cin >> id;
cin >> name;
hotel->rooms[num][j].guests->set_id(id);
hotel->rooms[n