c ++stl队列使用
To print all elements of a Queue, we follow the following steps:
要打印Queue的所有元素,请执行以下步骤:
Run a loop till "queue is not empty".
循环运行直到“队列不为空” 。
Print the first (oldest) element by using queue::front() method
通过使用queue :: front()方法打印第一个(最旧的)元素
Remove the oldest element (perform "pop" operation to remove the element)
删除最旧的元素(执行“ pop”操作以删除该元素)
Note: This process will remove all elements of the queue as well. The efficient way is discussed below.
注意:此过程还将删除队列中的所有元素。 有效方法将在下