Hard
Calculator That Never Crashes
Read lines
a op b until END (op is + - * /). Print the result (division as a float with 2 decimals). Print bad number if a or b isn't a number, bad operator for an unknown op, division by zero when dividing by 0, and bad format if the line doesn't have exactly three parts.Input
Lines, then END.
Output
Lines.
Sample 1
Input
3 + 4 10 / 4 5 / 0 x * 2 2 ^ 3 1 + END
Output
7 2.50 division by zero bad number bad operator bad format
Sample 2
Input
7 - 10 END
Output
-3
Output appears here