diff options
Diffstat (limited to 'c/dataStructure/栈和队列/队列/链队列/main.c')
-rwxr-xr-x | c/dataStructure/栈和队列/队列/链队列/main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/c/dataStructure/栈和队列/队列/链队列/main.c b/c/dataStructure/栈和队列/队列/链队列/main.c new file mode 100755 index 0000000..db5ae9a --- /dev/null +++ b/c/dataStructure/栈和队列/队列/链队列/main.c @@ -0,0 +1,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; +} |