Created
September 29, 2014 18:09
-
-
Save kuzemkon/295d76251300ba6859db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program project1; | |
{$mode objfpc}{$H+} | |
uses | |
{$IFDEF UNIX}{$IFDEF UseCThreads} | |
cthreads, | |
{$ENDIF}{$ENDIF} | |
Classes, crt | |
{ you can add units after this }; | |
var | |
x1,x2,x3,x4,y1,y2,y3,y4,a,b,c,p,p1,p2,p3,S,S1,S2,S3,a1,b1,c1,Z,K,V: real; | |
begin | |
writeln('Enter x1 and y1'); | |
read(x1,y1); | |
writeln('Enter x2 and y2'); | |
read(x2,y2); | |
writeln('Enter x3 and y3'); | |
read(x3,y3); | |
begin | |
a:=sqrt(sqr(x2-x1)+sqr(y2-y1)); | |
b:=sqrt(sqr(x3-x2)+sqr(y3-y2)); | |
c:=sqrt(sqr(x3-x1)+sqr(y3-y1)); | |
p:=(a+b+c)/2; | |
S:=sqrt(p*(p-a)*(p-b)*(p-c)); | |
writeln('Enter x4 and y4'); | |
read(x4,y4); | |
a1:=sqrt(sqr(x1-x4)+sqr(y1-y4)); | |
b1:=sqrt(sqr(x2-x4)+sqr(y2-y4)); | |
c1:=sqrt(sqr(x3-x4)+sqr(y3-y4)); | |
p1:=(a+a1+b1)/2; | |
p2:=(b+b1+c1)/2; | |
p3:=(c+a1+c1)/2; | |
S1:=sqrt(p1*(p1-a)*(p1-a1)*(p1-b1)); | |
S2:=sqrt(p2*(p2-b)*(p2-b1)*(p2-c1)); | |
S3:=sqrt(p3*(p3-c)*(p3-a1)*(p3-c1)); | |
Z:=S1+S2+S3; | |
K:=round(S*2)/2; | |
V:=round(Z*2)/2; | |
if (S1=0) and (S2=0) | |
then writeln('Point belongs to an edge of the triangle') | |
else | |
if (S2=0) and (S3=0) | |
then writeln('Point belongs to an edge of the triangle') | |
else | |
if (S1=0) and (S3=0) | |
then writeln('Point belongs to an edge of the triangle') | |
else | |
if (S1=0) or (S2=0) or (S3=0) | |
then writeln('Point belongs to the top of the triangle') | |
else | |
if (K=V) | |
then writeln('Point belongs to the triangleЄг') | |
else writeln('The point does not belong to the triangle') | |
end; | |
readkey; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment