#P138. 【例23.3】 简单计算器
【例23.3】 简单计算器
Description
Design a simple calculator that supports four operations: '+', '-', '*', and '/'.
Only consider integer input and output cases, and the data and operation results will not exceed the range of int.
Input Format
Input consists of a single line with three parameters: the first and second parameters are integers, and the third parameter is an operator ('+', '-', '*', '/', or other symbols).
Output Format
Output consists of a single line with one integer, the result of the operation. However:
If there is a division by zero, output: "Divided by zero!";
If there is an invalid operator (not one of '+', '-', '*', '/'), output: "Invalid operator!".
Sample
1 2 +3
Related
In following homework: