uses graph,crt;
var driver, mode,xp,x,y :integer;
x_t :real;
tic :string;
// (sqr(x)+x+1)/(sqr(x)-x+1);
function y_global(y:real):integer;
begin
if y<0 then
y_global:=240+trunc(abs(y*50))
else
y_global:=240-trunc(abs(y*50));
end;
function x_global(x:real):integer;
begin
if x<0 then
x_global:=240-trunc(abs(x*(630/8)))
else
x_global:=240+trunc(abs(x*(630/8)));
end;
begin
Driver:=VGA;
Mode:=VGAHi;// 640x480
InitGraph(Driver, Mode, 'C:\program files\FPC');
//axis
Line(240,0,240,480);
Line(00,240,640,240);
for y:=-4 to 4 do begin
str(y,tic);
if y<>0 then begin
MoveTo(x_global(0), y_global(y));
LineTo(x_global(0)+5,y_global(y));
outtextxy(x_global(0)+8, y_global(y), tic);
end;
end;
for x:=-3 to 5 do begin
x_t:=x;
while x_t<=x+1 do begin
xp:=x_global(x_t);
PutPixel( xp, y_global((sqr(x_t)+x_t+1)/(sqr(x_t)-x_t+1)), red );
x_t:=x_t+0.001;
end;
MoveTo(x_global(x),240);
LineTo(x_global(x),245);
str(x,tic);
outtextxy(x_global(x)+3, 250, tic);
end;
readln;
CloseGraph;
end.