-->
当前位置:首页 > 题库

PROGRAMMING:Solving simple four Operational expressions

Luz5年前 (2021-05-10)题库418
Input a four arithmetic expression, output the result of operation, require special treatment for the case of divisor 0. Ensure that the input and output are within the double precision range.
###Input format:
Input: input the operands 1, operator, and operands 2 in a row, with no spaces between them. The data type of the operands is real.
###Output format:
Output the result of the expression in one line, retaining two decimal places.
If the division denominator is 0, the error message "divider can not be 0!" is output; If an illegal operator other than addition, subtraction, multiplication and division is entered, the error message "unknown operator!" will be output.
###Input sample 1:
```in
3.1+4.8
```
###Output sample 1:
```out
seven point nine zero
```
###Input sample 2:
```in
98/0
```
###Output sample 2:
```out
Divisor can not be 0!
```
###Input sample 1:
```in
123%3
```
###Output sample 1:
```out
Unknown operator!
```






answer:If there is no answer, please comment