class Progarm
{
static void Main(string[] args)
{
Console.WriteLine("选择以下图形(输入图形序列号)");
Console.WriteLine("1、圆形,2、矩形,3、三角形);
string str = Console.ReadLine();
switch(str)
{
case "1":
Console.WriteLine("请录入圆的半径:");
int r = int.Parse(Console.ReadLine());
int yS = MG(r);
Console.WriteLine("圆的面积={0}",yS);
break;
case "2":
Console.WriteLine("请录入矩形的长:");
int c = int.Parse(Console.ReadLine());
Console.WriteLine("请录入矩形的宽:");
int k = int.Parse(Console.ReadLine());
int jS = MG(c, k);
Console.WriteLine("矩形的面积={0}",jS);
break;
case "3":
Console.WriteLine("请录入三角形的底长:");
int d = int.Parse(Console.ReadLine());
Console.WriteLine("请录入三角形的高:");
int g = int.Parse(Console.ReadLine());
int x = 2;
int sS = MG(d, g, x);
Comsole.WriteLine("三角形的面积={0}",sS);
break;
default:
Console.WriteLine("非法输入");
break;
}
}
static int MG(int r)
{
return Math.PI * r * r;
}
static int MG(int chang, int kuan)
{
return chang * kuan;
}
static int MG(int di, int gao, int x)
{
return di * gao / x;
}
}