===== PascalABC.NET =====
type
Point = (real, real);
Vector = Point;
function GetVector(A, B: Point) :=
(B[0] - A[0], B[1] - A[1]);
function PointInTriangle(A, B, C, P: Point): boolean;
begin
var bV := GetVector(A, B);
var cV := GetVector(A, C);
var pV := GetVector(A, P);
var k1 := (pV[0] * bV[1] - bV[0] * pV[1]) /
(cV[0] * bV[1] - bV[0] * cV[1]);
Result := False;
if (k1 >= 0) and (k1 <= 1) then
begin
var k2 := (pV[0] - k1 * cV[0]) / bV[0];
Result := (k2 >= 0) and (k1 + k2 <= 1)
end
end;
begin
var x, y: real;
var A, B, C, P: Point;
Write('Координаты точки A: '); Read(x, y);
A := (x, y);
Write('Координаты точки B: '); Read(x, y);
B := (x, y);
Write('Координаты точки C: '); Read(x, y);
C := (x, y);
Write('Координаты точки P: '); Read(x, y);
P := (x, y);
Writeln(PointInTriangle(A, B, C, P)); // True - принадлежит
end.