Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. var
  2. x1, x2, x3, x4, y1, y2, y3, y4, x, y, k1, k2, b1, b2, t: real;
  3. begin
  4. readln (x1, y1, x2, y2);
  5. readln (x3, y3, x4, y4);
  6. if (x1 >= x2) then
  7. begin
  8. t := x1;
  9. x1 := x2;
  10. x2 := t;
  11. t := y1;
  12. y1 := y2;
  13. y2 := t;
  14. end;
  15. if (x3 >= x4) then
  16. begin
  17. t := x3;
  18. x3 := x4;
  19. x4 := t;
  20. t := y3;
  21. y3 := y4;
  22. y4 := t;
  23. end;
  24. if (y1 = y2) then
  25. k1 := 0
  26. else
  27. k1 := ( y2 - y1 ) / ( x2 - x1 );
  28. if (y3 = y4) then
  29. k2 := 0
  30. else
  31. k2 := ( y4 - y3 ) / ( x4 - x3 );
  32. if (k1 = k2) then
  33. begin
  34. writeln('Empty');
  35. exit;
  36. end;
  37. b1 := y1 - k1 * x1;
  38. b2 := y3 - k2 * x3;
  39. x := (b2 - b1) / (k1 - k2);
  40. y := k1 * x + b1;
  41. writeln(x:6:10);
  42. writeln(y:6:10);
  43. readln();
  44. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement