polish notation

This is a discussion on polish notation within the C Programming forums, part of the General Programming Boards category; does any one know how to make polish notation? e.g "6+2*(3-2)" to "3 2 - 2 * 6 +" pls ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    4

    polish notation

    does any one know how to make polish notation?
    e.g "6+2*(3-2)" to "3 2 - 2 * 6 +"
    pls teach me or give sth related for me to read.
    Thanks

  2. #2
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    If you have a calculation "(6+2)*(3-2)" and you want this to be converted to polish notation you must always at first put the brackets into the calculation on the right place. And you see that the operand * will calculate (6+2) and (3-2) and you write it down like this *(6+2)(3-2). The next step will be, inside the brackets, 6+2. You see that the operand + will calculate 6 and 2 and you write it down like this *+62(3-2) and now the last one *+62-32

    and if you want this to convert back to normal notation you do it this way:

    at first you look at the * and the other two operands. * will multiply +62 and -32 and you can write it between the brackets like this (+62)*(-32). The solution is (6+2)*(3-2).

    I'll try to explain.

    First operand will always calculate the last two variables in our case is this +62 and -32. And you write (+62)*(-32). And now you do the same thing. In the brackets you have (+62). Operand + will calculate 6 and 2 and you write 6 + 2, and so on.

    I hope you got it. If you don't understand yet, just ask.

    bye!
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Impix or reverse polish notation
    By P4R4N01D in forum C Programming
    Replies: 10
    Last Post: 11-18-2008, 10:42 PM
  2. Postfix (reverse polish notation) calculator
    By ottomated in forum C Programming
    Replies: 7
    Last Post: 05-06-2008, 05:32 PM
  3. problems on polish notation
    By blacksnake in forum C Programming
    Replies: 15
    Last Post: 06-23-2007, 03:52 AM
  4. polish notation calc problem
    By deedlit in forum C Programming
    Replies: 6
    Last Post: 06-14-2004, 10:17 PM
  5. problem on reverce polish notation
    By dionys in forum C++ Programming
    Replies: 0
    Last Post: 05-14-2004, 01:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21