//小淇在敲代码
package p2;
import java.io.IOException;
public class 判断用户从键盘上输入的运算符再输出计算后的结果 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int a=100,b=6;
char oper;
System.out.println("请输入运算符:");
oper=(char)System.in.read();
switch(oper)
{
case'+':
System.out.println(a+"+"+b+"="+(a+b));
break;
case'-':
System.out.println(a+"-"+b+"="+(a-b));
break;
case'*':
System.out.println(a+"*"+b+"="+(a*b));
break;
case'/':
System.out.println(a+"/"+b+"="+((float)a/b));
break;
default:
System.out.println("输入的符号不正确!");
}
}
}