summaryrefslogtreecommitdiff
path: root/c/dataStructure/栈和队列/队列/链队列/main.c
blob: db5ae9a0ae659a0895af24ed23028bed1319d958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "queue.h"

int main(void)
{
    ElemType e;
    pqueue head, tail;
    InitQueue(&head);
    InitQueue(&tail);

    while ((e = getchar()) != '\n')
    {
        EnQueue(&tail, &e);
        if (EmptyQueue(&head))
            head = tail;
    }

    PrintQueue(&head);
    ElemType retval;

    DeQueue(&head, &retval);
    printf("'%c' quit queue\n",retval);

    PrintQueue(&head);

    RsQueue(&head);

    return 0;
}