#include<iostream>
#include <time.h>
using namespace std;
//=====事件数据结构=====
typedef struct{//事件数据
int OccurTime;//事件发生时间
int NType;//事件类型,0为到达事件,1,2,3,4,分别表示窗口的离开事件
}Event;
typedef struct{//窗口事件队列
int ArrivalTime;//到达时间
int Duration;//办理业务所需时间
}QElemType;//此为队列的数据元素
//=====链表操作=====
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;//函数结果状态代码
typedef Event LElemType;
//结点数据类型为int
typedef struct LNode
{
LElemType data;
struct LNode *next;
}LNode,*LinkList;
typedef LinkList EventList;//事件链表
Status GetElem_L(LinkList L,int i,LElemType e)
{//得到L的第i个元素赋予e
if(L->next==NULL)return ERROR;//空链表返回0
LinkList p=L->next;//p指向链表的第一个元素
int j=1;
while(p&&j<i)
{//判断语句p不为空且j<i
p=p->next;
j++;//滚动向下
}
if(!p||j>i)retur
队列-模拟离散事件
最新推荐文章于 2019-03-11 18:00:19 发布