package com.zsk.scanner;
import java.util.Scanner;
public class demo {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int a=0;
int b=0;
double result=0;
System.out.println("请输入第一个数");
if(s.hasNextInt()){
a=s.nextInt();
}
System.out.println("请选择你要计算的字符:");
char c=s.next().charAt(0);
System.out.println("请输入第二个数");
if(s.hasNextInt()){
b=s.nextInt();
}
switch(c){
case '+':
result=a+b;
break;
case '-':
result=a-b;
break;
case '':
result=ab;
break;
case '/':
if(b==0){
System.out.println("无意义");
break;
}else{
result=a/b;
break;
}
default:
System.out.println("滚你妈的");
break;
}
System.out.println("结果为:"+result);
}
}