Advertisement
VXP

Untitled

VXP
Sep 19th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.79 KB | None | 0 0
  1. uses CRT,DOS;
  2. var x1,x2,x3,y1,y2,y3:real;
  3.     A,B,C:real;
  4.     D,E,F:Single;
  5. begin
  6.     clrscr;
  7.    
  8.     x1 := 0;
  9.     y1 := -5;
  10.     x2 := 10;
  11.     y2 := 0;
  12.     x3 := 10;
  13.     y3 := 5;
  14.  
  15.     A := sqrt( sqr(x1-x2) + sqr(y1-y2) );
  16.     B := sqrt( sqr(x2-x3) + sqr(y2-y3) );
  17.     C := sqrt( sqr(x3-y1) + sqr(y3-y1) );
  18.     if not ((A + B <= C) or (A + C <= B) or (B + C <= A)) then
  19.     begin
  20.         writeln('Ne treugolnik');
  21.         ReadKey;
  22.         exit;
  23.     end;
  24.  
  25.     D := (x1-0) * (y2-y1) - (x2-x1) * (y1-0);
  26.     E := (x2-0) * (y3-y2) - (x3-x2) * (y2-0);
  27.     F := (x3-0) * (y1-y3) - (x1-x3) * (y3-0);
  28.     if (((D >= 0) and (E >= 0) and (F >= 0)) or ((D <= 0) and (E <= 0) and (F <= 0))) then
  29.     begin
  30.         writeln('Nachalo koordinat prinadleshit treugolniku');
  31.     end
  32.     else
  33.     begin
  34.         writeln('Nachalo koordinat ne prinadleshit treugolniku');
  35.     end;
  36.  
  37.     ReadKey;
  38. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement