#include using namespace std; class stack { int data; stack* next; public: stack(); int pop(); void push(int); }; stack::stack() { data=0; next=NULL; } int stack::pop() { if(next==NULL) { cout<<"Stack empty"<next->next!=NULL) p=p->next; int temp=p->next->data; delete p->next; return temp; } void push(int a) { stack* p=this; while(p->next!=NULL) p=p->next; p->next=new stack; p->next->data=a; }