コード例 #1
0
 private void InputTriangle_TextChanged(object sender, EventArgs e)
 {
     try
     {
         equilateralTriangle = new EquilateralTriangle(Convert.ToInt32(InputSide.Text));
     }
     catch (Exception ex)
     {
         OutPut.Text = ex.ToString();
     }
 }
コード例 #2
0
        static void Main()
        {
            Triangle triangle1 = new Triangle(10, 20, 25);

            Console.WriteLine("Angle 1 2 = {0}, Angle 2 3 = {1}, Perimeter = {2}", triangle1.ComputeAngle(1, 2),
                              triangle1.ComputeAngle(2, 3),
                              triangle1.ComputePerimeter());

            triangle1.ChangeSide(23, 2);
            Console.WriteLine("Angle 1 2 = {0}, Angle 2 3 = {1}, Perimeter = {2}", triangle1.ComputeAngle(1, 2),
                              triangle1.ComputeAngle(2, 3),
                              triangle1.ComputePerimeter());

            EquilateralTriangle etriengleTriangle = new EquilateralTriangle(10);

            Console.WriteLine("Angle 1 2 = {0}, Angle 2 3 = {1}, Perimeter = {2}, Area = {3}",
                              etriengleTriangle.ComputeAngle(1, 2),
                              etriengleTriangle.ComputeAngle(2, 3),
                              etriengleTriangle.ComputePerimeter(),
                              etriengleTriangle.Area);
        }