Merge branch 'master' of http://bdgit.educoder.net/mfayus5fk/p7fet2yns
commit
ce97d76dda
@ -0,0 +1,31 @@
|
||||
package computer;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class compute {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
Double op1;
|
||||
Double op2;
|
||||
String op;
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("请输入第一个操作数(回车结束)");
|
||||
op1=sc.nextDouble();
|
||||
System.out.println("请输入运算符(回车结束)");
|
||||
op=sc.next();
|
||||
System.out.println("请输入第二个操作数(回车结束)");
|
||||
op2=sc.nextDouble();
|
||||
System.out.print("结果是:");
|
||||
switch(op) {
|
||||
case "+":System.out.println(coputer1(op1,op2));break;
|
||||
case "-":System.out.println(coputer1(op1,op2));break;
|
||||
case "*":System.out.println(coputer1(op1,op2));break;
|
||||
case "/":System.out.println(coputer1(op1,op2));break;
|
||||
case "^":System.out.println(function(op1,op2));break;
|
||||
case "log":System.out.println(logax(op1,op2));break;
|
||||
case "e^" :System.out.println(calcalate(op2));break;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in new issue