提给的太简单,甚至不用考虑溢出或运算/时是否用double
代码:
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
char c = sc.next().charAt(0);
int a = sc.nextInt();
int b = sc.nextInt();
switch(c){
case '+':System.out.println(a+b);break;
case '-':System.out.println(a-b);break;
case '*':System.out.println(a*b);break;
case '/':System.out.println(a/b);break;
}
}
}