using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("输入一个数字:");
int a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("输入运算符(+—*/)");
// c=Console.ReadLine();
char str = Convert.ToChar(Console.ReadLine());
Console.WriteLine("第二个数:");
int b = Int32.Parse(Console.ReadLine());
//int c = a + b;
//Console.WriteLine("和为:{0}",c);
switch (str)
{
case '+':
Console.WriteLine("和为:{0}", a + b);
break;
case '-':
Console.WriteLine("差为:{0}", a - b);
break;
case '*':
Console.WriteLine("积为:{0}", a * b);
break;
case '/':
Console.WriteLine("商为:{0}", a / b);
break;
case '%':
Console.WriteLine("余数为:{0}", a % b);
break;
default:
Console.WriteLine("请输入正确的运算符!!");
break;
}
Console.ReadKey();
}
}
}