Program Dothi;
Uses Crt,Graph;
Const
ScaleX=20;
ScaleY=80;
Var mh,mode,x,y,i:integer;
Begin
InitGraph(mh,mode,'F:\WINAPPS\BP\BGI');
SetViewPort(GetmaxX DIV 2,GetmaxY DIV 2,GetmaxX,GetmaxY,ClipOff);
SetColor(blue);
Line(-(GetmaxX DIV 2),0,GetmaxX DIV 2,0);
Line(0,-(GetmaxY DIV 2),0,GetmaxY DIV 2);
SetTextJustify(CenterText,CenterText);
SetColor(White);
OutTextXY(-GetmaxX DIV 4,-GetmaxX DIV 4,'DO THI HINH SIN ');
SetColor(Red);
OutTextXY(GetmaxX DIV 2- 32,2,'Truc x >');
OutTextXY(27,-(GetmaxY DIV 2-5),'^ Truc y');
OutTextXY(0,0,'0,0');
for i:= -400 to 400 do
begin
x:=Round(2*Pi*i* ScaleX /200);
y:=Round(Sin(2*Pi*i/200)* ScaleY);
PutPixel(x,y,Yellow);
end;
Repeat Until KeyPressed;
CloseGraph;
End.
Uses Crt,Graph;
Const
ScaleX=20;
ScaleY=80;
Var mh,mode,x,y,i:integer;
Begin
InitGraph(mh,mode,'F:\WINAPPS\BP\BGI');
SetViewPort(GetmaxX DIV 2,GetmaxY DIV 2,GetmaxX,GetmaxY,ClipOff);
SetColor(blue);
Line(-(GetmaxX DIV 2),0,GetmaxX DIV 2,0);
Line(0,-(GetmaxY DIV 2),0,GetmaxY DIV 2);
SetTextJustify(CenterText,CenterText);
SetColor(White);
OutTextXY(-GetmaxX DIV 4,-GetmaxX DIV 4,'DO THI HINH SIN ');
SetColor(Red);
OutTextXY(GetmaxX DIV 2- 32,2,'Truc x >');
OutTextXY(27,-(GetmaxY DIV 2-5),'^ Truc y');
OutTextXY(0,0,'0,0');
for i:= -400 to 400 do
begin
x:=Round(2*Pi*i* ScaleX /200);
y:=Round(Sin(2*Pi*i/200)* ScaleY);
PutPixel(x,y,Yellow);
end;
Repeat Until KeyPressed;
CloseGraph;
End.