Infix To Postfix Lab 3 Program
Infix To Postfix Lab 3 Program
Infix To Postfix Lab 3 Program
int Stack::isEmpty()
{
if(top==-1)
return 1;
else
return 0;
}
int Stack::isFull()
{
if(top==size-1)
return 1;
else
return 0;
}
int Stack::stackTop()
{
if(!isEmpty())
return(opstk[top]);
else
cout<<"\n NO ELEMENT IN THE STACK";
}
char Stack::pop()
{
if(isEmpty())
return 0;
else
return opstk[top--];
}
class Conversion
{
Stack s;//COPY CONSTRUCTOR.
char postfix[20];
public:
void infixtopostfix(char []);
int prec(char,char);
int isp(char);
int icp(char);
};
int main()
{
char exp[20];
Conversion c;
cout<<"\nEnter the expression:";
cin>>exp;
cout<<"\n THE POSTFIX EXPRESSION:";
c.infixtopostfix(exp);
return 0;
}