上传者: u011098035
|
上传时间: 2019-12-21 21:21:29
|
文件大小: 2KB
|
文件类型: java
RPN计算器
Program Input
Each line of the input file (prob12.in) contains a series of numbers and operators. The program must evaluate these lines as RPN expressions. All tokens are separated by one or more spaces. Numbers may be negative. Valid operators are +(addition), -(subtraction), *(multiplication) and /(division). The last line of the file contains only the word END:
16 3 7 + *
4 32.125 13 – * 20 +
5 –3 * 4 2 / 6 3 1 – / + +
END
Program Output
The program will print the computed result of each RPN expression on a separate line.
160
96.5
-10