Скачиваний:
289
Добавлен:
04.03.2014
Размер:
1.82 Кб
Скачать

Program Pr4; {3 Ї а Ў®«л}
uses Graph;
const Xc=320; Yc=200; mas=20;
label 1;
var a,b,c,d,f,e,z,y,s,Xmax:real;
x:array [1..6] of real;
i,n,gd,gm:integer;

Procedure RKY (a,b,c:real); { ђҐиҐ­ЁҐ Єў. га ў­Ґ­Ёп }
var Ds:real;
Begin
Ds:=b*b-4*a*c;
If Ds>0 then begin n:=n+2; x[n-1]:=(-b-sqrt(Ds))/(2*a);
x[n]:=(-b+sqrt(Ds))/(2*a) end;
If Ds=0 then begin n:=n+1; x[n]:=-b/(2*a) end;
End;

Procedure PP (a,b,c:real;z:byte); { Џ®бв஥­ЁҐ Ї а Ў®«л }
const razb=10000; Dx=10;
var Xver,t,h:real;
x,y:integer;
Begin
SetColor (z);
Xver:=(-b)/(2*a);
h:=(2*Dx)/razb;
t:=Xver-Dx;
For i:=0 to razb do begin
x:=round(t*mas);
y:=round((a*t*t+b*t+c)*mas);
PutPixel (x+Xc,-y+Yc,z);
t:=t+h;
end;
End;

BEGIN
1:Writeln ('‚ўҐ¤ЁвҐ Є®нд. (Ј¤Ґ a,d,z ­Ґ а ў­л 0) :a,b,c,d,f,e,z,y,s');
ReadLn (a,b,c,d,f,e,z,y,s);
If (a=0) or (d=0) or (z=0) then GoTO 1;
n:=0;
RKY (a,b,c);
RKY (d,f,e);
RKY (z,y,s);
gd:=detect;
InitGraph (gd,gm,' ');
MoveTo (Xc,Yc);
SetColor (1);
Line (0,Yc,GetMaxX,Yc);
Line (Xc,0,Xc,GetMaxY);
PP (a,b,c,11);
PP (d,f,e,12);
PP (z,y,s,13);
For i:=-20 to 20 do begin
PutPixel (Xc,Yc+i*mas,15);
PutPixel (Xc+i*mas,Yc,15);
end;
If n=0 then write ('Љ®а­Ё ўбҐе га ў­Ґ­Ё© ­Ґ¤Ґ©б⢨⥫м­л')
else begin
Xmax:=x[1];
for i:=1 to n do if x[i]>Xmax then Xmax:=x[i];
write ('Њ ЄбЁ¬ «м­л© Є®аҐ­м=',Xmax:5:3);
end;
SetColor (14);
If n>0 then Circle (Round(Xmax*mas)+Xc,Yc,3);
readln;
END.
Соседние файлы в папке Alex