You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.2 KiB
70 lines
1.2 KiB
#include <iostream>
|
|
#include <vector>
|
|
#include <fstream>
|
|
#include <string>
|
|
|
|
// 学生类
|
|
class Student {
|
|
public:
|
|
std::string name;
|
|
int id;
|
|
std::string major;
|
|
int grade;
|
|
// 构造函数、其他方法等
|
|
};
|
|
|
|
// 宿舍类
|
|
class Dormitory {
|
|
public:
|
|
int roomNumber;
|
|
int capacity;
|
|
std::string location;
|
|
std::vector<int> studentIds; // 存储学生ID
|
|
// 构造函数、其他方法等
|
|
};
|
|
|
|
// 宿舍管理系统类
|
|
class DormitoryManagementSystem {
|
|
private:
|
|
std::vector<Student> students;
|
|
std::vector<Dormitory> dormitories;
|
|
|
|
void loadFromFiles() {
|
|
// 从文件加载数据
|
|
}
|
|
|
|
void saveToFiles() {
|
|
// 将数据保存到文件
|
|
}
|
|
|
|
public:
|
|
DormitoryManagementSystem() {
|
|
loadFromFiles();
|
|
}
|
|
|
|
~DormitoryManagementSystem() {
|
|
saveToFiles();
|
|
}
|
|
|
|
void addStudent(const Student& student) {
|
|
students.push_back(student);
|
|
}
|
|
|
|
void addDormitory(const Dormitory& dormitory) {
|
|
dormitories.push_back(dormitory);
|
|
}
|
|
|
|
void assignDormitory(int studentId, int dormitoryRoomNumber) {
|
|
// 分配学生到宿舍
|
|
}
|
|
|
|
// 其他管理功能...
|
|
};
|
|
|
|
int main() {
|
|
DormitoryManagementSystem system;
|
|
// 实现用户界面逻辑
|
|
return 0;
|
|
}
|
|
|