import java.util.Scanner;
public class Sum_
{
public static void main(String args[])
{
int x,y;
char k;
String str ;
Scanner reader= new Scanner(System.in);
while((str=reader.nextLine())!=null)
{
k=str.charAt(1);
x=Integer.parseInt(String.valueOf(str.charAt(0)));
y=Integer.parseInt(String.valueOf(str.charAt(2)));
switch(k)
{
case '+':
System.out.printf("%d\n",x+y);
break;
case '-':
System.out.printf("%d\n",x-y);
break;
case '*':
System.out.printf("%d\n",x*y);
break;
case '/':
System.out.printf("%d\n",(double)x/(double)y);
break;
default :
System.out.printf("输入错误\n");
break;
}
str="";
//System.out.printf("%d",);
}
}
}
Calculator
最新推荐文章于 2024-05-24 10:05:45 发布