Programming Practice

1. initial_queue()：設排序定連結表成為空的連結表，將陣列設定為一個選擇的長度 (如 10 個元素)；

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

5. isEmpty()：檢查佇列是否為空；

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

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

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

3. 輸出頭部的元素，

4. 測試佇列是否為空，

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

6. 終止程式執行。

 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: 5