本文整理汇总了C#中Circle.Length方法的典型用法代码示例。如果您正苦于以下问题:C# Circle.Length方法的具体用法?C# Circle.Length怎么用?C# Circle.Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Circle
的用法示例。
在下文中一共展示了Circle.Length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
List<TwoDim> twodim = new List<TwoDim>();
List<ThreeDim> threedim = new List<ThreeDim>();
while (true)
{
Console.WriteLine("도형종류 : Triangle, Square, Circle, Cube, Sphere");
double number;
Console.Write("단위 크기 : ");
try
{
number = Double.Parse(Console.ReadLine());
if (number<=0)
{
Console.WriteLine("잘못된 범위의 값을 입력하였습니다.");
continue;
}
}
catch (System.FormatException x)
{
Console.WriteLine(x.Message);
continue;
}
catch (SystemException y)
{
Console.WriteLine(y.Message);
continue;
}
Console.Write("모양 : ");
string whatShape = Console.ReadLine();
int count = 0;
int i = 0;
if (whatShape != "Triangle" && whatShape != "Square" && whatShape != "Circle"&&whatShape!="Cube"&&whatShape!="Sphere")
{
Console.WriteLine("없는 도형입니다.");
continue;
}
else if (whatShape == "Triangle")
{
TwoDim tri = new Triangle();
foreach (var item in twodim)
{
if (twodim[i].typeTwo == 3 && twodim[i].numTwo == number)
{
Console.WriteLine("이미 담은 도형입니다.");
count += 1;
break;
}
i++;
}
if (count == 0)
{
tri.typeTwo = 3;
tri.numTwo = number;
tri.Length(number);
tri.Area(number);
twodim.Add(tri);
i = 0;
}
count = 0;
}
else if (whatShape == "Square")
{
TwoDim squ = new Square();
foreach (var item in twodim)
{
if (twodim[i].typeTwo == 4 && twodim[i].numTwo == number)
{
Console.WriteLine("이미 담은 도형입니다.");
count += 1;
break;
}
i++;
}
if (count == 0)
{
squ.typeTwo = 4;
squ.numTwo = number;
squ.Length(number);
squ.Area(number);
twodim.Add(squ);
i = 0;
}
count = 0;
}
else if (whatShape == "Circle")
{
TwoDim cir = new Circle();
foreach (var item in twodim)
{
if (twodim[i].typeTwo == 0 && twodim[i].numTwo == number)
{
Console.WriteLine("이미 담은 도형입니다.");
count += 1;
break;
}
i++;
}
//.........这里部分代码省略.........