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
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 ...
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
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)