Page 450 - C++
P. 450
if((Symbol[0]=='*' || Symbol[0]=='/') && top!=-1)
{
Temp[0]=pop();
while((Temp[0]=='^' || Temp[0]=='*' || Temp[0]=='/') &&
top!=-1)
{
strcat(pexp,Temp);
Temp[0]=pop( );
}
push(Temp[0]);
}
else if((Symbol[0]=='+' || Symbol[0]=='-') && top !=-1)
{
Temp[0]=pop();
while(Temp[0]!='(' || top!=-1)
{
strcat(pexp,Temp);
Temp[0]=pop();
}
push(Temp[0]);
}
push(Symbol[0]);
}
else
{
strcat(pexp,Symbol);
}
}
while(top!=-1)
{
Temp[0]=pop();
strcat(pexp," ");
strcat(pexp,Temp);
}
out(pexp);
}
/*************************************************************/
void stack::push(long int l)
{
if(top+1==50)
cout<<"\n Overflow";
else
{
s[++top]=l;
}
}
/*************************************************************/
long stack::pop()
{
if(top==-1)