#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<string.h>#include"queue.h"int main()
{
Queue line;
Item temp;
char ch;
InitializeQueue(&line);
puts("Testing the Queue interface. Type a to add to value.");
puts("type d to delete a value, and type q to quit.");
while ((ch = getchar()) != 'q')
{
if (ch != 'a' && ch != 'd')
continue;
if (ch = 'a')
{
printf("Interger to add:");
scanf("%d", &temp);
if (!(QueueIsFull(&line)))
{
printf("Puting %d into queue\n", temp);
EnQueue(temp, &line);
}
elseputs("Queue is full");
}
else
{
if (QueueIsEmpty(&line))
puts("Nothing is full");
else
{
DeQueue( &temp, &line);
printf("Removing %d from queue\n", temp);
}
}
printf("%d items in queue\n", QueueItemCount(&line));
puts("Type a to add, d to delete, q to quit:");
}
EmptyTheQueue(&line);
puts("Bye!");
return0;
}
/*书中差一个查看已有队列的函数*/