Board index » delphi » Scientific Calculator (HELP NEEDED!!!)

Scientific Calculator (HELP NEEDED!!!)

Hi,
     I need, to do a program using Turbo Pascal... It's a Scientific
calculator with the operation +-*/ ^ div and uses parentesis () {} []
and it's has capabilitys of using Variables ...

   My _BIG_ problem is to do the procedure, of putting in a Stack in
pos-fixed way (e.g. A+B       AB+  Pos-fixed)  because the prioraty of
parentesis and *,/,div,^...

    Can some one give me a help/hint, or if you have a similar
program/procedure send it to me...

Thanks in advance,

Ricardo Goncalves
Email: np9...@mail.telepac.pt

 

Re:Scientific Calculator (HELP NEEDED!!!)


     This Algebraic -> Postfix problem keeps popping up again and again.
There are a number of ways to accomplish it, each having merit of its own,
and each designed for specific input conditions.  
     Will somebody with access to the complete SWAG check and see if the
answers are there.  If not, please post them there, so we can say "See
SWAG" or From SWAG, the following (program)/(algorithm) should be a help.

Re:Scientific Calculator (HELP NEEDED!!!)


Quote
JWillard44 (jwillar...@aol.com) wrote:

:      This Algebraic -> Postfix problem keeps popping up again and again.
: There are a number of ways to accomplish it, each having merit of its own,
: and each designed for specific input conditions.  
:      Will somebody with access to the complete SWAG check and see if the
: answers are there.  If not, please post them there, so we can say "See
: SWAG" or From SWAG, the following (program)/(algorithm) should be a help.

i'm sort of confused.. what exactly is the purpose of postfix? why would
saying "xy+" be more useful (or useful in any way) than "x+y"? maybe it's
in a math class i haven't gottten to :)

victor dods

Re:Scientific Calculator (HELP NEEDED!!!)


Re:Scientific Calculator (HELP NEEDED!!!)


In <4r43un$...@newsbf02.news.aol.com>, jwillar...@aol.com (JWillard44) writes:

Quote
>mang...@netcom.com (Victor Dods) wrote:
>> i'm sort of confused.. what exactly is the purpose
>> of postfix? why would saying "xy+" be more
>> useful (or useful in any way) than "x+y"? maybe
>> it's in a math class i haven't gottten to :)

For stack-based languages such as Pascal or C, postfix is necessary to ensure
that operands are evaluated in the correct order.

The compiler generates instructions that are pushed onto and popped off of
the stack in postfix sequence. This is also the method used by bytecode
interpreters such as REXX.

Regards,

Brian Grainger
Box 1507, Sparwood, BC
1.604.425.7801
brian.grain...@mail.rmin.net

Other Threads