|
@@ -255,3 +255,23 @@ else
|
|
|
}
|
|
|
```
|
|
|
|
|
|
+##### Задание №9
|
|
|
+```
|
|
|
+const double Ax = 0, Ay = 0;
|
|
|
+const double Bx = 4, By = 0;
|
|
|
+const double Cx = 0, Cy = 3;
|
|
|
+
|
|
|
+Console.WriteLine("Введите координаты точки D (x y):");
|
|
|
+double Dx = double.Parse(Console.ReadLine());
|
|
|
+double Dy = double.Parse(Console.ReadLine());
|
|
|
+
|
|
|
+double ABC = Math.Abs((Bx - Ax) * (Cy - Ay) - (Cx - Ax) * (By - Ay)) / 2;
|
|
|
+double ABD = Math.Abs((Bx - Ax) * (Dy - Ay) - (Dx - Ax) * (By - Ay)) / 2;
|
|
|
+double ACD = Math.Abs((Dx - Ax) * (Cy - Ay) - (Cx - Ax) * (Dy - Ay)) / 2;
|
|
|
+double BCD = Math.Abs((Cx - Bx) * (Dy - By) - (Dx - Bx) * (Cy - By)) / 2;
|
|
|
+
|
|
|
+if (Math.Abs(ABC - (ABD + ACD + BCD)) < 0.000001)
|
|
|
+Console.WriteLine("Точка принадлежит треугольнику");
|
|
|
+else
|
|
|
+Console.WriteLine("Точка не принадлежит треугольнику");
|
|
|
+```
|