Thread: Translation of a b c + * a / c b + d / - into prefix form

  1. #1
    Registered User mlupo's Avatar
    Join Date
    Oct 2001
    Posts
    72

    Translation of a b c + * a / c b + d / - into prefix form

    For translation of "a b c + * a / c b + d / - " to infix I get:
    a*b+c/a-c+b/d

    But to translate "a b c + * a / c b + d / - " into prefix I am certainly not getting it.
    can someone please help?

    Thanks in advance,
    Mike
    NEVER PET YOUR DOG WHILE IT'S ON FIRE!

  2. #2
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    Your translation to infix is wrong, it should be

    a * ( b + c ) / a - ( c + b ) / d

    ( don't forget that you often need parenthesis in with infix notation )

    - about your question about changing postfix to prefix, you could just change it to infix first and then change the infix to prefix if that's easier for you.

  3. #3
    Registered User mlupo's Avatar
    Join Date
    Oct 2001
    Posts
    72
    Hi,

    So let me extend the question a little...
    does it make sense to factor out any of the redundancy?
    essentially, the a's could cancel out to this...

    (b+c)-((c+b)/d)

    Would this be an ok practice to use?

    Thanks in advance,
    Mike
    NEVER PET YOUR DOG WHILE IT'S ON FIRE!

  4. #4
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    yes that is an equivalent expression. Wheter you reduce the fraction or not depends on what you want to do. If your assignment is just to change an postfix expression to infix, I wouldn't reduce it because you weren't asked to. But mathematically it is totally correct.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reopening a form ?
    By Aga^^ in forum C# Programming
    Replies: 1
    Last Post: 02-11-2009, 09:28 AM
  2. Calling datas from another form?
    By Aga^^ in forum C# Programming
    Replies: 2
    Last Post: 02-06-2009, 02:17 AM
  3. Accessing main form from functions in other classes
    By pj_martins in forum C++ Programming
    Replies: 1
    Last Post: 11-05-2004, 09:27 AM
  4. My UserControls dissapear off my form
    By zMan in forum C# Programming
    Replies: 2
    Last Post: 09-15-2004, 08:55 AM
  5. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 11:20 AM