static void Main(string[] args)
{
Console.WriteLine("依次输入两个数值和一个运算符");
double y=0;
double x1 = Convert.ToDouble(Console.ReadLine());
double x2 = Convert.ToDouble(Console.ReadLine());
string z = Convert.ToString(Console.ReadLine());
switch(z)
{
case "+":
y = x1 + x2;
break;
case "*":
y = x1 * x2;
break;
case "-":
y = x1 - x2;
break;
case "/":
y = x1 / x2;
break;
default:
Console.WriteLine("运算符输入错误");
break;
}
Console.WriteLine(y );
Console.ReadLine();
}
{
Console.WriteLine("依次输入两个数值和一个运算符");
double y=0;
double x1 = Convert.ToDouble(Console.ReadLine());
double x2 = Convert.ToDouble(Console.ReadLine());
string z = Convert.ToString(Console.ReadLine());
switch(z)
{
case "+":
y = x1 + x2;
break;
case "*":
y = x1 * x2;
break;
case "-":
y = x1 - x2;
break;
case "/":
y = x1 / x2;
break;
default:
Console.WriteLine("运算符输入错误");
break;
}
Console.WriteLine(y );
Console.ReadLine();
}