#include #include #include "Stack1.h" stack::stack() { stack_ptr = new int [100]; //constructor max_len = 99; top_ptr = -1; } stack::~stack() {delete [] stack_ptr;} //destructor void stack::push (int number) { if (top_ptr == max_len) cout << "error stack is full\n"; else stack_ptr[++top_ptr] = number; } int stack::pop() { if (top_ptr == -1) { cout << "error stack is empty\n"; return 0;} else return (stack_ptr[top_ptr--]); } int stack::top() {return (stack_ptr[top_ptr]);} int stack::empty() {return (top_ptr == -1);}