/*
* testqueue.cpp
*/
#include
#include "queue.h"
int main()
{
Queue Q = NULL;
int i;
Q = CreateQueue(12);
for (i = 0; i < 10; ++i)
{
Enqueue(i, Q);
}
while (!IsEmpty(Q))
{
printf("%d\n", Front(Q));
Dequeue(Q);
}
for (i = 0; i < 10; ++i)
{
Enqueue(i, Q);
}
while (!IsEmpty(Q))
{
printf("%d\n", Front(Q));
Dequeue(Q);
}
DisposeQueue(Q);
return 0;
}
/*
* queue.h
*/
#ifndef _QUEUE_H
#define _QUEUE_H
#ifndef NULL
#define NULL (0)
#endif
typedef int ElementType;
struct QueueRecord;
typedef struct QueueRecord *Queue;
#ifdef __cplusplus
extern "C" {
#endif
Queue CreateQueue(int MaxElements);
void MakeEmpty(Queue Q);
void DisposeQueue(Queue Q);
int IsEmpty(Queue Q);
int IsFull(Queue Q);
vo