Показать сообщение отдельно

  #9  
Старый 09.11.2009, 19:36
Vinsik
Участник форума
Регистрация: 04.10.2008
Сообщений: 154
Провел на форуме:
203408

Репутация: 7
По умолчанию

Код:
program TABULIR_FUNC;

uses graph;

var
mx,my,x,h:real;
intI,x1,x2:integer;
gd,gm:integer;

function xm(x:real):integer;
         begin
              xm:=round(320+mx*x);
         end;

function ym(y:real):integer;
         begin
         ym:=round(240-my*x);
         end;

function  f(a:real):real;
          begin
          f:=2*exp(a)+4;
          end;

procedure linovka;
var x,y:integer;
begin
setcolor(15);{color is white}
x:=5;y:=0;
repeat {draw vertical line}
line(x,0,x,GetMaxY);
x:=x+35;
until x>GetMaxX;
repeat {draw horizontal line}
line(0,y,GetMaxX,y);
y:=y+30;
until y>GetMaxY;
end;

procedure DrawAxis;
begin
setcolor(blue);{color is white}
{draw axis of ordinate}
line(round(GetMaxX/2),0,round(GetMaxX/2),GetMaxY);
line(round(GetMaxX/2),0,round(GetMaxX/2-5),10);
line(round(GetMaxX/2),0,round(GetMaxX/2+5),10);
{draw axis of abscis}
line(round(GetMaxX),round(GetMaxY /2),GetMaxX-10,round(GetMaxY/2-5));
line(round(GetMaxX),round(GetMaxY /2),GetMaxX-10,round(GetMaxY/2+5));
line(0,round(GetMaxY/2),GetMaxX,round(GetMaxY/2));
end;

begin
mx:=10;{Mashtab X}
my:=10;{Mashtab Y}
h:=0.001;
x1:=-10;
x2:=10;

writeln('Tabulirovanie funkzii');
writeln('	X	','Y');
for intI:=x1 to x2 do  writeln('    X = ',intI,'    Y = ',f(intI):6:4);
writeln('Press any key');

readln;
gd:=detect;
initgraph(gd,gm,'D:\user\program\bp\bgi');
linovka;
DrawAxis;

x:=x1;
while (x<=x2) do begin
putpixel(xm(x),ym(f(x)),red);
x:=x+h;
end;

readln;
closegraph;
end.
можно блок схему плиз?
 
Ответить с цитированием