<html><div style='background-color:'><DIV>I just want to see if anyone has a postfix code or algorithm (without recursion) or if anyone could give me some ideas for one because it seems like a daunting task.</DIV>
<DIV> </DIV>
<DIV>Postfix is used in calculator programs. A postfix function takes a line of calculations like</DIV>
<DIV>3 ^ 2 + 4.5 * 7.3 / (2 + 5) and turns it into something the computer can use to make the calculations. By hand, the line is supposed to be turned into postfix notation after first converting it to infix notation, putting parentheses in according to order of operations (i.e, ^, %, *, /, +, -).</DIV>
<DIV>So, by hand, that line of calculations in infix notation would be</DIV>
<DIV>( (3^2) + ( (4.5 * 7.3) / (2 + 3) )</DIV>
<DIV>To convert this to postfix notation, all operations are moved to the left of their respective parentheses, so that line becomes</DIV>
<DIV>( (3 2)^ ( (4.5 7.3)* (2 3)+ )/ )+</DIV>
<DIV>The final step is to remove all the parentheses, and the postfix notation is</DIV>
<DIV>3 2 ^ 4.5 7.3 * 2 3 + / +</DIV>
<DIV>To make processing a postfix line of calculations easier, i usually set off numbers by the '#' sign</DIV>
<DIV>#3##2#^#4.5##7.3#*#2##3#+/+</DIV>
<DIV> </DIV>
<DIV>if anyone has any ideas on how to convert the original line</DIV>
<DIV>3 ^ 2 + 4.5 * 7.3 / (2 + 5)</DIV>
<DIV>to</DIV>
<DIV>
<DIV>#3##2#^#4.5##7.3#*#2##3#+/+</DIV>
<DIV>without using recursion, you will become my personal hero.</DIV></DIV></div><br clear=all><hr>Get your FREE download of MSN Explorer at <a href='http://g.msn.com/1HM305401/13'>http://explorer.msn.com</a>.<br></html>
|