using System;
calss Program
{
public void DisPlay()
{
////if else å switch case
//// åå«å®ç°ç®å计ç®å¨
///*
// * è¾å
¥ä¸¤ä¸ªæ°åï¼ç¶åéæ©è¿ç®ï¼æç»æ¾ç¤ºè¿ç®ç»æ
// * /
Console.WriteLine("请è¾å
¥ç¬¬ä¸ä¸ªæ°å");
double a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请è¾å
¥ç¬¬äºä¸ªæ°å");
double b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请éæ©éè¦çè¿ç®ï¼");
Console.WriteLine("1:+");
Console.WriteLine("2:-");
Console.WriteLine("3:*");
Console.WriteLine("4:/");
string chose = Console.ReadLine();
switch (chose)
{
case "+":
case "1":
Console.WriteLine("{0}+{1}={2}", a, b, a + b);
break;
case "-":
case "2":
Console.WriteLine("{0}-{1}={2}", a, b, a - b);
break;
case "*":
case "3":
Console.WriteLine("{0}*{1}={2}", a, b, a * b);
break;
case "/":
case "4":
Console.WriteLine("{0}/{1}={2}", a, b, a / b);
break;
default:
Console.WriteLine();
break;
}
}
}
温馨提示:答案为网友推荐,仅供参考