When using stacks and queues of standard libraries, first include the relevant header files
#include <stack>
#include <queue>
The definition stack is as follows:
Stack<int> Stk;
The definition queue is as follows:
Queue<int> Q;
The stack provides the following actions
S.empty () returns True if the stack is empty, otherwise false
S.size () returns the number of elements in the stack
S.pop () removes the top element of the stack without returning its value
S.top () returns the element at the top of the stack without deleting the element
S.push () pushes a new element at the top of the stack
The queue provides the following actions
Q.empty () returns True if the queue is empty, otherwise false
Q.size () returns the number of elements in the queue
Q.pop () deletes the first element of the queue but does not return its value
Q.front () Returns the value of the first element of the team, but does not delete the element
Q.push () Press the new element at the end of the team
Q.back () Returns the value of the tail element of the queue, but does not delete the element
C + + stacks and queues