Programming Practice

1. initial_queue()：設排序定連結表成為空的連結表，

2. enqueue()：將某個值的節點放入佇列的尾部 (tail)，

4. print_queue()：從頭部至尾部列印佇列中所有節點的值

5. print_queue_reverse()：從尾部至頭部列印佇列中所有節點的值。

1. 將某個值的節點放入佇列的尾部，

2. 將佇列的頭部的節點移出，並印出該節點的值

3. 從頭部至尾部列印佇列中所有節點的值

4. 從尾部至頭部列印佇列中所有節點的值

5. 終止程式執行。

 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 1 Enter an enqueued element: 50 Element 50 have been enqueued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 1 Enter an enqueued element: 64 Element 64 have been enqueued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 1 Enter an enqueued element: 40 Element 40 have been enqueued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 3 The element(s) of queue from the head to the tail are (is):  50  64  40 **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 2 Element 50 has been dequeued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 1 Enter an enqueued element: 86 Element 86 have been enqueued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 1 Enter an enqueued element: 18 Element 18 have been enqueued. **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 4 The element(s) of queue from the tail to the head are (is):  18  86  40  64 **************************************************** 1. Enqueue 2. Dequeue 3. Print queue 4. Print queue reverse 5. Quit **** Enter a command: 5