大家帮忙填写这段代码
模拟题,看了好久没什么头绪
// 模拟一个 5 人混检的场景,有100人来检测,其中每个人的 id 自动从 1 ~ 100,
// 混检组号自动从 1 ~ 20(每 5 人一致),按要求完成程序
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
class DateTime
{
public:
int year;
int month;
int day;
int hour;
int minute;
int second;
};
//Test 类
class TestQueue;
class Test
{
private:
int id; //个人ID,累增即可,从 1 开始
string name; //姓名
DateTime time; //时间
int groupId; //每 5 个人安排一个 groupId,自动累增,从 1 开始
friend ostream& operator << (ostream& ostr, const Test& t);
friend class TestQueue;
};
class TestQueue
{
private:
Test* tests;
//这里补充必要的其他成员变量(第一处)
public:
//填充必要的构造函数代码,若没有可以不填写(第二处)
TestQueue()
{
}
//完成添加一个测试的函数(第三处)
void AddTest(string name, DateTime time)
{
//填充数组中的 Test 对象,此处完成 ID 和 GroupID 的累增
//将 nt 加入队列
}
//返回第i个测试信息,完成运算符 [ ] 的重载(第四处)
const Test& operator[](int i)
{
}
//填充必要的析构造函数代码,若没有可以不填写(第五处)
~TestQueue()
{
}
};
//完成Test输出的重载(第六处)
ostream& operator << (ostream& ostr, const Test& t)
{
return ostr;
}
void main()
{
TestQueue queue;
//to do: 模拟100个测试者,建立100个Test对象,加入queue
for (int i = 0; i < 100; ++i)
{
string name; //记录姓名
DateTime time; //记录时间
//其中,在主函数中完成对时间的模拟,即从2022年5月1日早晨8:00开始,每间隔1分钟整来一个测试者
//每个人的姓名采用5个连续 A ~ Z 大写字母的随机组合
//(第七处)
queue.AddTest(name, time);
}
//输出第17到26个测试者的信息
for (int j = 17; j < 27; ++j)
{
cout << j << "\t" << queue[j] << endl;
}
}