Stack isn't popping off correct data?
You're not telling it how big your stack should be, and it defaults to 0 entries, which means nothing gets stored.

class Stack
{
private:
    int *p;
    int top,length;

public:
    Stack(int = 0);  &lt;&lt;== CONSTRUCTOR - DEFAULT SIZE IS 0
    ~Stack();

    void push(int);
    int pop();
    void display();
};


When you make your Stack object you must give it a size for the number of entries in the stack:

Stack stack(4);