Here is my complete code. I have really tried everything but couldn't understand where i am going wrong. There is NO ERROR in compilation but the output does take in the elements and output is not being generated. My compiler is Borland 10.5
#include <iostream>
#include <conio>
class ListStack
{
private:
struct node
{
int num;
node *next;
}*top;
int operand_count;
public:
ListStack()
{
top=NULL;
}
int push(int);
int pop();
void display();
void get_expression();
int get_value(int);
};
int ListStack::push(int c)
{
node *temp;
temp = new node;
temp->num=c;
temp->next=top;
top=temp;
return c;
}
int ListStack::pop()
{ int c;
if(top==NULL)
cout<<"Stack UnderFlow"<<endl;
else
{
node *temp;
temp=top;
cout<<"deleted Number from the stack = ";
c=top->num;
top=top->next;
//return (temp->num);
delete temp;
return (c);
}
}