ADD file via upload

main
pofu6wkq7 12 months ago
parent 07636924ac
commit 28a4865f7f

@ -0,0 +1,69 @@
#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;
}
Loading…
Cancel
Save