void stack::push(int item) { if (top == 4) { cout << "stack is full"<<endl; //didnt work in old compiler } else { top++; x[top] = item; } }
and
void stack::pop() { if (top == -1) { cout << "stack is empty"; //looped in old compiler } else { cout << "deleted item is" << x[top]; top--; } }
not looking for fix but explaination