Uses CRT, Graph;
Const
ShX=30;
ShY=30;
Var
CfX,CfY,Xgr,Ygr,i:Integer;
x,y,dx:Real;
s:String;
Function F(z:real):Real;
begin
F:=Cos(z-1.0)+Abs(z);
end;
Begin
InitGraph(..., ...); [COLOR=Red][B]{ тут самостоятельно }[/B][/COLOR]
CfX:=(GetMaxX-2*ShX) div 4;
CfY:=(GetMaxY-2*ShY) div 3;
SetLineStyle(SolidLn,0,ThickWidth);
Line(ShX,GetMaxY-ShY,ShX+CfX*4,GetMaxY-ShY);
Line(ShX,ShY,ShX,ShY+CfY*3);
SetLineStyle(DottedLn,0,NormWidth);
SetTextJustify(CenterText, TopText);
x:=-2.0;
STR(x:4:1,s);
OutTextXY(ShX,ShY+CfY*3+8,s);
for i:=1 to 8 do
begin
x:=-2.0+0.5*i;
STR(x:4:1,s);
Xgr:=ShX+Round(0.5*i*CfX);
OutTextXY(Xgr,ShY+CfY*3+8,s);
Line(Xgr,ShY,Xgr,ShY+CfY*3);
end;
SetTextJustify(RightText, CenterText);
y:=0;
STR(y:3:1,s);
OutTextXY(ShX-4,GetMaxY-ShY,s);
for i:=1 to 6 do
begin
y:=0.5*i;
STR(y:3:1,s);
Ygr:=GetMaxY-ShY-Round(y*CfY);
OutTextXY(ShX-4,Ygr,s);
Line(ShX,Ygr,ShX+Round(CfX*4),Ygr);
end;
SetLineStyle(SolidLn,0,ThickWidth);
x:=-2.0;
y:=Cos(-3.0)+2;
Xgr:=ShX;
Ygr:=GetMaxY-ShY-Round(F(x)*CfY);
MoveTo(Xgr,Ygr);
dx:=0.02;
for i:=1 to 200 do
begin
x:=x+dx;
y:=F(x);
Xgr:=ShX+Round((x+2)*CfX);
Ygr:=GetMaxY-ShY-Round(F(x)*CfY);
LineTo(Xgr,Ygr);
end;
ReadKey;
CloseGraph;
End.