کد:#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int intstack[20],inttop=-1;
void intpush(int);
int intpop();
int postfix_count(char[]);
int main()
{
char ch[30];
clrscr();
cout<<"Please enter string: ";
cin.get(ch,'\n');
cout<<postfix_count(ch);
getch();
return 0;
}
void intpush(int item)
{
if (inttop==(20-1))
cout<<"Stack is full";
else
intstack[++inttop]=item;
}
int intpop()
{
if (inttop==-1)
cout<<"stack is empty";
else
return(intstack[inttop--]);
return 0;
}
int postfix_count(char st[]) {
int i,a,b;
for(i=0;st[i];i++)
if(st[i]=='+')
{
a=intpop();
b=intpop();
intpush(b+a);
}
else if (st[i]=='-')
{
a=intpop();
b=intpop();
intpush(b-a);
}
else if (st[i]=='*')
{
a=intpop();
b=intpop();
intpush(b*a);
}
else if (st[i]=='/')
{
a=intpop();
b=intpop();
intpush(b/a);
}
else
intpush(st[i]-'0');
return intstack[inttop];
}