// Standard template library example of queues and stacks #include #include #include using namespace std; int main () { stack myStack; // create an empty stack queue myQueue; // create an empty queue myStack.push(10); myStack.push(11); myStack.push(12); cout << "The stack size: " << myStack.size() << endl; cout << "Top item is: " << myStack.top() << endl; myStack.pop(); // remove the top item cout << "Top item is now: " << myStack.top() << endl; myStack.push(13); cout << "New Top item is: " << myStack.top() << endl; myQueue.push(20); myQueue.push(21); myQueue.push(22); cout << "The queue size: " << myQueue.size() << endl; cout << "Queue front: " << myQueue.front() << endl; cout << "Queue back: " << myQueue.back() << endl; getchar(); return 0; }