Name: Title:

 Name:
ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT

User Submitted Source Code!

Description:
pkfdf.pas
Language: PASCAL
Code:
Program hfdf;
uses crt,oglgraph;
var xrmin,yrmin,xrmax,yrmax:integer;
xfmin,xfmax,kx:real;
xe,ye,lineX0:integer;
xf:real;
Gm,Gd:integer;

function f(x:real):real;
begin
if 3*x*x-1=0 then
f:=0
else
f:=1/(3*x*x-1);
end;

procedure square(x1,y1,x2,y2:integer);
begin
line(x1,y1,x2,y1);
line(x1,y2,x2,y2);
line(x1,y1,x1,y2);
line(x2,y1,x2,y2);
end;

Begin

Gm:=0;
Gd:=0;
initgraph(Gd,Gm,'');

xrmin:=100;
yrmin:=100;
xrmax:=1000;
yrmax:=1000;

xfmin:=-7;
xfmax:=2;
xf:=xfmin;

xe:=xrmin;
kx:=(xrmax-xrmin)/(xfmax-xfmin);
writeln(kx);

lineX0:=round(xrmin-xfmin/(xfmax-xfmin)*(xrmax-xrmin));
line(lineX0,yrmin,lineX0,yrmax);
line(xrmin,(yrmin+yrmax)div 2,xrmax,(yrmin+yrmax)div 2);
square(xrmin,yrmin,xrmax,yrmax);

while xe<xrmax do begin
xe:=round(xf*kx*lineX0);
ye:=round((yrmin+yrmax)div 2-fxf)*kx);

if (xrmin<=xe) and (xe<=xrmax) and (yrmin<ye) and (yrmax>=ye) then
putPixel(xe,ye,15);
xf:=xf+0.01;
end;

repeat
until GraphkeyPressed;

End.