#include #include using namespace std; // empty(): Checks to see if the stack is empty. // pop(): Deletes the element from the top of the stack. // push(): Adds element to the top of the stack. // size(): Computes and returns the number of elements in the stack. // top(): Returns a reference to an element at the top of the stack. int main() { // Stacks stack s; int x; int& y = x; s.push(8); s.push(9); s.push(3); s.push(3); s.push(8); s.push(4); s.push(9); cout << "Number of elements in stack is: " << s.size() << endl; while (! s.empty()) { y = s.top(); cout << "Element on top of stack is " << y << endl; s.pop(); } }