first commit

master
YiBo 4 years ago
parent 411f091e18
commit 91d2554548

@ -0,0 +1,26 @@
import java.util.Scanner;
public class CALC{
public static void main(String args[]) {
double x;
double y;
String z;
Scanner sc=new Scanner(System.in);
System.out.println("输入第一个数");
x=sc.nextDouble();
System.out.println("输入运算符");
z=sc.next();
System.out.println("输入第二个数");
y=sc.nextDouble();
System.out.print("结果是:");
switch(z) {
case"+":System.out.println(x+y);
break;
case"-":System.out.println(x-y);
break;
case"*":System.out.println(x*y);
break;
case"/":System.out.println(x/y);
break;
}
}
}
Loading…
Cancel
Save