The stack template in the Standard Template Library can be used as a vector or a list. Using the class stack in the STL, defi ne and test a vector based stack. The class stack has the following methods that you can use to test your program:
stack(); // Default constructor
bool empty() const; // Tests whether the stack is empty
ItemType& top(); // Returns a reference to the top of the stack
void push(const ItemType& newEntry); // Adds newEntry to the top of the stack
void pop(); // Removes the top of the stack
To access stack , use the following include statement:
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here