C++-----------酒店客房管理系统

酒店客房管理系统 要求:
1.客房信息管理:包括客房的编号、类型、价格、状态等信息的录入和修改;
2.顾客信息管理:包括顾客的基本信息、预订信息等的管理;
3.客房预订:客户可以根据需要进行客房的预订,系统会自动判断客房的可用情况;
4.入住管理:客户入住时需要进行登记,同时系统会自动更改客房的状态信息;
*5.结账管理:客户结账需要进行登记,同时系统会自动更改客房的状态信息;
*6.统计报表:包括客房的使用情况、收入情况等的统计报表。

5和6 功能可选 使用文件保存信息
在这里插入图片描述

在这里插入代码片
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <string>

// 客房类
class Room {
   
public:
    int number;
    std::string type;
    double price;
    std::string status;  // "available", "occupied", "reserved"

    Room(int num, std::string t, double p) : number(num), type(t), price(p), status("available") {
   }
};

// 顾客类
class Customer {
   
public:
    std::string name;
    std::string contact;
    int roomNumber;
    std::string checkInDate;
    std::string checkOutDate;

    Customer(std::string n, std::string c, int room, std::string in, std::string out)
        : name(n), contact(c), roomNumber(room), checkInDate(in), checkOutDate(out) {
   }
};

// 客房信息管理
class RoomManagement {
   
private:
    std::vector<Room> rooms;
    std::string roomFilePath = "rooms.txt";

    void saveRoomsToFile() {
   
        std::ofstream file(roomFilePath);
        for (const auto& room : rooms) {
   
            file << room.number << "," << room.type << "," << room.price << "," << room.status << std::endl;
        }
        file.close();
    }

    void loadRoomsFromFile() {
   
        std::ifstream file(roomFilePath);
        std::string line;
        while (std::getline(file, line)) {
   
            std::istringstream iss(line);
            int number;
            std::string type;
            double price;
            std::string status;
            std::getline(iss, type, ',');
            iss >> number;
            iss.ignore();
            std::getline(iss, type, ',');
            iss >> price;
            iss.ignore();
            std::getline(iss, status, ',');
            rooms.push_back(Room(number, type, price))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

~jing静

ლ(°◕‵ƹ′◕ლ)让我一键努

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值