Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include"Stack.h"
- stack::stack() {
- top = -1;
- arr[NUM]=NULL;
- }
- void stack::setTop(int top) {
- this->top = top;
- }
- int stack::getTop() const {
- return this->top;
- }
- int stack::checkTop() const {
- return arr[getTop()];
- }
- bool stack::empty() const {
- return (top == 0);
- }
- void stack::push(int element) {
- setTop(getTop()+1);
- arr[getTop()] = element;
- }
Add Comment
Please, Sign In to add comment