[Tutor] Using a Stack to evaluate postfix....?

evros loizie@hotmail.com
Tue Jun 17 23:51:02 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C33522.CD1CE910
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

what happen if we have an example with a negative number ex:
((2*3)-10)=3D -4     in postfix will be liek that 23*10- is that =
correct?
if i try to use stack now to evaluate i will have :push 2 then push =
3,then perfom the operation* so we have 6 push 6 then push 10 then pop =
the operand off the stack. my question now are we gona have 10-6 or 6-10 =
. which one is going first?
thanks for teh help

------=_NextPart_000_0005_01C33522.CD1CE910
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style=3D"COLOR: #000000; FONT-FAMILY: " bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>what happen if we have an example with =
a negative=20
number ex:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>((2*3)-10)=3D =
-4&nbsp;&nbsp;&nbsp;&nbsp; in postfix=20
will be liek that 23*10- is that correct?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if i try to use stack now to evaluate i =
will have=20
:push 2 then push 3,then perfom the operation* so we have 6 push 6 then =
push 10=20
then pop the operand off the stack. my question now are we gona have =
10-6 or=20
6-10 . which one is going first?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>thanks for teh help</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0005_01C33522.CD1CE910--