Console.WriteLine("请输入第一个数");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("请输入第二个数");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("请输入运算符'+','-','*','/'");
string c = Console.ReadLine();
if (c == "+")
{
int resount;
resount = a + b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "-")
{
int resount; resount = a - b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "*")
{
int resount; resount = a * b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "/") { int resount;
resount = a / b;
Console.WriteLine("结果是{0}", resount);
}
else
{
Console.WriteLine("请输入有效的运算符");
} Console.ReadKey();
int a = int.Parse(Console.ReadLine());
Console.WriteLine("请输入第二个数");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("请输入运算符'+','-','*','/'");
string c = Console.ReadLine();
if (c == "+")
{
int resount;
resount = a + b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "-")
{
int resount; resount = a - b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "*")
{
int resount; resount = a * b;
Console.WriteLine("结果是{0}", resount);
}
else if (c == "/") { int resount;
resount = a / b;
Console.WriteLine("结果是{0}", resount);
}
else
{
Console.WriteLine("请输入有效的运算符");
} Console.ReadKey();