i got a problem with negative unary operator - i do not know how to implement it in my code, can someone help me do this? I got whole calculator written in java fx everything works fine, but i need to implement feature that allows user to calculate expression like: -5 + 3 * 8 or 3 + 2 * (-8). Waiting for your answer, regards
Asked
Active
Viewed 641 times
0
-
Your problem seems the fact that you didn't implement anything related to unary operators at all. You need to distinguish an unary minus from a binary minus so that the conversion is done correctly and the evaluator just pops a single value instead that two. See: http://stackoverflow.com/questions/1593080/how-can-i-modify-my-shunting-yard-algorithm-so-it-accepts-unary-operators – Jack Jul 22 '15 at 12:32
-
thank you Jack for your kind help i've managed my problem;) – thosenumbers Jul 23 '15 at 08:28