示例#1
0
        static void Main(string[] args)
        {
            RWStream stream = new RWStream();

            try
            {
                Triangle triangle = stream.ReadTriangleFromFile("input.txt");
                stream.WriteToFile($"Perimeter = {triangle.Perimeter} { Environment.NewLine}Square = {triangle.Square}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
 public Triangle(Point point1, Point point2, Point point3)
 {
     this.point1 = point1;
     this.point2 = point2;
     this.point3 = point3;
     ab          = LengthSide(point1, point2);
     bc          = LengthSide(point2, point3);
     ac          = LengthSide(point1, point3);
     try
     {
         if (((point1.X == point2.X) && (point1.X == point3.X)) ||
             ((point1.Y == point2.Y) && (point1.Y == point3.Y)))
         {
             throw new Exception("No exist triangle");
         }
     }
     catch (Exception e)
     {
         RWStream stream = new RWStream();
         stream.WriteToFile(e.Message);
         throw e;
     }
 }