Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
pofu6wkq7 | 28a4865f7f | 1 year ago |
pofu6wkq7 | 07636924ac | 1 year ago |
pofu6wkq7 | ebf496d4e1 | 1 year ago |
pos542ex3 | e1a40a4268 | 1 year ago |
Binary file not shown.
@ -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;
|
||||
}
|
||||
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
宿舍管理系统需求分析
|
Loading…
Reference in new issue