【例23.3】 简单计算器
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
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
20251213 A班作业(10)
- Status
- Done
- Problem
- 10
- Open Since
- 2025-12-13 0:00
- Deadline
- 2025-12-21 23:59
- Extension
- 24 hour(s)