用C++编写的高校实验任务安排程序

来源:百度知道 编辑:UC知道 时间:2024/07/04 19:40:44
问题描述:设计数据结构及算法完成高校实验任务的安排任务。
功能要求:
⑴ 插入:将预约做实验的学生插入到合适的时间队列中;
⑵ 删除:时间队列中前5位学生可以在该时间做实验;
⑶ 查询:教师可以随时查询某个时间队列中学生的预约情况;
⑷ 修改:在没做实验之前,学生可以对预约的时间进行修改;
⑸ 输出:输出每个时间队列中预约的学生名单。
考察:队列的应用:主要涉及到队列的特性。

我自己写的,看看能用不!~

#include <conio.h> //输出输入函数的头文件
#include <fstream.h> //数据流输入/输出
#include <string.h> //字符串处理
#include <stdlib.h> //定义杂项函数及内存分配函数
#include <stdio.h> //C的输入输出流
#define MAXSIZE 100
typedef int ElemType;
struct student //学生的记录信息
{ElemType key; //学号
char name[8]; //姓名
};
class SeQueue
{ private:
ElemType elem[MAXSIZE];
int front,rear;
public:
SeQueue();
~SeQueue();
void Display();
void AddQ(ElemType x);
ElemType DelQ();
void save();
};
SeQueue::SeQueue()
{
front=0;
rear=0;
cout<<"排队系统初始化完成"<<endl;
}
SeQueue::~SeQueue()
{};
void SeQueue::save()
{
ofstream of( "C:/0605030112.txt");
ElemType x; int j=0;
if(rear==front)
{
cout<<"队列为空";}
else{