/*
* LkQueue.h
*
* Created on: Oct 7, 2015
* Author: chris
*/
#ifndef LKQUEUE_H_
#define LKQUEUE_H_
#include<iostream>
using namespace std;
template<class ElemType>
struct LQNode{
ElemType data;
LQNode<ElemType> * next;
LQNode() : next(NULL) {}
};
template<class ElemType>
struct LkQueue{
LQNode<ElemType> * front;
LQNode<ElemType> * rear;
};
template<class ElemType>
bool LkQueueCreate(LkQueue<ElemType>& lq)
{
lq.front = lq.rear = new LQNode<ElemType>;
if (!lq.front) return false;
else return true;
}
template<class ElemType>
void LkQueueDestroy(LkQueue<ElemType>& lq)
{
LQNode<ElemType> * pcur;
while (lq.front) {
pcur = lq.front;
lq.front = lq.front->next;
delete pcur;
}
lq.rear = NULL;
}
template<class ElemType>
void LkQueueClear(LkQueue<ElemType>& lq)
{
LQNode<ElemType> * sub = lq.fro
C++实现离散事件模拟--Bank_Simulation
最新推荐文章于 2021-07-18 23:22:24 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)