----------------------------------------------------------------------
MZ-SPECIAL 005  (Betr.: TURBOPASCALPROGRAMM MINIFRAC)         klf-8/95
----------------------------------------------------------------------

program frac;          (*MZ-800/CP/M mit Grafik-Dr.Vachenauer*)
                       (*Autor des Pascalprogrammes unbekannt*)
                       
var a1,b1,c1,xa,ya,x,y,xn            :real;
    an,t,p1,p2                       :integer;
    title                            :string10;
    taste                            :char;

    procedure plot(spalte,zeile,mode:integer); external $cb0f;
    procedure hcopy;                           external $cb09;

function fnr(x:real)                 :real;
var sgn                              :integer;
begin
  if x>0 then sgn:=1 else sgn:=-1;
  fnr:=y-sgn*sqrt(abs(b1*x-c1));
end;

procedure parameterliste;
var tb,w,p,ft                        :integer;
begin
    tb:=70;p:=16;ft:=9;
    gotoxy(tb,p-1);write(title);
    gotoxy(tb,p+1);write(an:ft); gotoxy(tb,p+2);write(a1:ft);
    gotoxy(tb,p+3);write(b1:ft); gotoxy(tb,p+4);write(c1:ft);
    gotoxy(tb,p+5);write(xa:ft); gotoxy(tb,p+6);write(ya:ft);
end;

(* HAUPTPROGRAMM *)

begin
  x:=0;y:=0; title:='Mini-Frac:';
  clrscr; writeln(title); writeln('----------');
  write('Rechenschritte: ');readln(an);  delay(200);
  write('a1-Wert:        ');readln(a1);  delay(200);
  write('b1-Wert:        ');readln(b1);  delay(200);
  write('c1-Wert:        ');readln(c1);  delay(200);
  write('x-Wert:         ');readln(xa);  delay(200);
  write('y-Wert:         ');readln(ya);
  xa:=xa+160;

  clrscr;
  for t:=1 to an do begin
     xn:=fnr(x);  y:=a1-x;  x:=xn;
     p1:=round(x+xa);  p2:=round(y+ya);
     plot(p1,p2,1);
  end;

  parameterliste;
  gotoxy(70,24);  write('end1/prn2');
  repeat read(kbd,taste)
  until taste in'1','2';
  if taste='2' then hcopy;
end.

