import java.util.Scanner;
public class Prog1 {
public static void main(String[] args) {
Scanner cin=new Scanner(System.in );
int a=cin.nextInt();
int b=cin.nextInt();
String str1=cin.nextLine();
String str=cin.nextLine();
char c=str.charAt(0);
switch(c)
{
case '+':{
System.out.print(a+"+"+b+"="+(a+b));
break;
}
case '-':{
System.out.print(a+"-"+b+"="+(a-b));
break;
}
case '*':{
System.out.print(a+"*"+b+"="+(a*b));
break;
}
case '/':{
System.out.print(a+"/"+b+"="+(a/b));
break;
}
case '%':{
System.out.print(a+"%"+b+"="+(a%b));
break;
}
}
}
}
追问我是想问 程序的输入为一个数学表达式的字符串形式,如 (2+23)*(34-2),然后程序输出结果。这样的怎么做呢?