Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- x1, x2, x3, x4, y1, y2, y3, y4, x, y, k1, k2, b1, b2, t: real;
- begin
- readln (x1, y1, x2, y2);
- readln (x3, y3, x4, y4);
- if (x1 >= x2) then
- begin
- t := x1;
- x1 := x2;
- x2 := t;
- t := y1;
- y1 := y2;
- y2 := t;
- end;
- if (x3 >= x4) then
- begin
- t := x3;
- x3 := x4;
- x4 := t;
- t := y3;
- y3 := y4;
- y4 := t;
- end;
- if (y1 = y2) then
- k1 := 0
- else
- k1 := ( y2 - y1 ) / ( x2 - x1 );
- if (y3 = y4) then
- k2 := 0
- else
- k2 := ( y4 - y3 ) / ( x4 - x3 );
- if (k1 = k2) then
- begin
- writeln('Empty');
- exit;
- end;
- b1 := y1 - k1 * x1;
- b2 := y3 - k2 * x3;
- x := (b2 - b1) / (k1 - k2);
- y := k1 * x + b1;
- writeln(x:6:10);
- writeln(y:6:10);
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement