用c++写一个美发店管理系统‘
时间: 2024-06-07 18:11:46 浏览: 9
好的,以下是一个简单的美发店管理系统的C++代码:
```c++
#include <iostream>
#include <string>
using namespace std;
class Customer {
private:
string name;
string phone;
int age;
string gender;
public:
Customer(string n, string p, int a, string g) {
name = n;
phone = p;
age = a;
gender = g;
}
string getName() {
return name;
}
string getPhone() {
return phone;
}
int getAge() {
return age;
}
string getGender() {
return gender;
}
};
class Hairdresser {
private:
string name;
string phone;
string title;
public:
Hairdresser(string n, string p, string t) {
name = n;
phone = p;
title = t;
}
string getName() {
return name;
}
string getPhone() {
return phone;
}
string getTitle() {
return title;
}
};
class Appointment {
private:
Customer customer;
Hairdresser hairdresser;
string date;
string time;
public:
Appointment(Customer c, Hairdresser h, string d, string t) {
customer = c;
hairdresser = h;
date = d;
time = t;
}
Customer getCustomer() {
return customer;
}
Hairdresser getHairdresser() {
return hairdresser;
}
string getDate() {
return date;
}
string getTime() {
return time;
}
};
int main() {
Customer c1("张三", "13812345678", 25, "男");
Hairdresser h1("李四", "13987654321", "高级发型师");
Appointment a1(c1, h1, "2022-01-01", "10:00");
cout << "客户姓名:" << a1.getCustomer().getName() << endl;
cout << "预约发型师姓名:" << a1.getHairdresser().getName() << endl;
cout << "预约日期:" << a1.getDate() << endl;
cout << "预约时间:" << a1.getTime() << endl;
return 0;
}
```
这个系统包含了三个类:顾客(Customer)、发型师(Hairdresser)和预约(Appointment)。其中,顾客和发型师类中包含了姓名、电话、年龄、性别和职称等信息,预约类中包含了一个顾客、一个发型师、一个日期和一个时间。在主函数中,我们创建了一个预约并输出了预约的相关信息。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)