You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
752 B
33 lines
752 B
package N;
|
|
|
|
import java.util.List;
|
|
import java.util.Scanner;
|
|
|
|
public class Main {
|
|
|
|
public static void main(String[] args) {
|
|
// TODO Auto-generated method stub
|
|
Scanner scan = new Scanner(System.in);
|
|
int i = scan.nextInt();
|
|
switch(i) {
|
|
case 1://计算e^x
|
|
break;
|
|
case 2://计算logax
|
|
break;
|
|
case 3://计算加减乘除
|
|
Scanner scanner=new Scanner(System.in);
|
|
System.out.println("输入表达式:");
|
|
String expression=scanner.next();
|
|
Calculation calculation=new Calculation();
|
|
List<String> rpnList=calculation.InfixtoList(expression);
|
|
List<String> tr=calculation.ListtoSuffix(rpnList);
|
|
int res=calculation.calculate(tr);
|
|
System.out.println(res);
|
|
break;
|
|
case 4://计算三角函数
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|