Скачать Circle Finder

21.12.1992
Скачать файл (8,00 Кб)





Program Circle_Finder;
 
uses Crt;
 
var
  answer,
  cont     : Char;
  out      : Text;
  X1,X2,X3,
  Y1,Y2,Y3,
  Part1,
  Part2,
  Part3,
  Part4,
  X,Y,
  Radius   : Real;
 
Procedure Title;
begin
  Clrscr;
  Writeln;
  Writeln('Circle Finder');
  Writeln;Writeln;
  Writeln('This program will find the center and');
  Writeln('radius of a circle that is determined');
  Writeln('by any three points in a plane that ');
  Writeln('does not form a straight line.');
  Writeln;
  Writeln('Note: For all entries that require');
  Writeln('      data entries (x,y); separate ');
  Writeln('      all data with a space.');
  Writeln;Writeln;
end;  { Title }
 
Procedure Input;
begin
  Write('Enter first point  (X,Y):   ');
  Readln(X1,Y1);
  Write('Enter second point (X,Y):   ');
  Readln(X2,Y2);
  Write('Enter third point  (X,Y):   ');
  Readln(X3,Y3);
  Writeln;Writeln;Writeln;
end;
 
Procedure Find;
begin
  Part1 := ((X2-X1) * (X2+X1) + (Y2-Y1) * (Y2 + Y1)) /
           (2.0 * (X2-X1));
  Part2 := ((X3-X1) * (X3+X1) + (Y3-Y1) * (Y3 + Y1)) /
           (2.0 * (X3-X1));
  Part3 := (Y2 - Y1) / (X2 - X1);
  Part4 := (Y3 - Y1) / (X3 - X1);
  Y := (Part2 - Part1) / (Part4 - Part3);
  X := Part2 - Part4 * Y;
  Radius := SQRT (SQR (X3 - X) + SQR (Y3 - Y));
end;
 
Procedure Print1;
begin
   Writeln('The circle defined by the following'