MoveTo(l,b);LineTo(l,b-h); MoveTo(x0,y0);LineTo(x0+w,y0); TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3));MoveTo(x0,y0);LineTo(x0+w,y0); TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3)); TextOut(l+5,b,FloatToStrF(y1,ffGeneral,6,3)); |
x1:=0;x2:=25;dx:=0.01;y1:=f(x1);y2:=f(x1);x:=x1
|
bet | 3/3 | Sana | 17.02.2024 | Hajmi | 87,03 Kb. | | #158299 |
Bog'liq DELPHI DASTURLASH TILIDA GEOMETRIK CHIZMALARBu sahifa navigatsiya:
- MoveTo(l,b);LineTo(l,b-h); MoveTo(x0,y0);LineTo(x0+w,y0); TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3));
- MoveTo(x0,y0);LineTo(x0+w,y0); TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3)); TextOut(l+5,b,FloatToStrF(y1,ffGeneral,6,3));
x1:=0;x2:=25;dx:=0.01;y1:=f(x1);y2:=f(x1);x:=x1;
repeat
y := f (x); if y < y1 then y1:=y; if y > y2 then y2:=y; x:=x+dx; until (x >= x2);
my:=h/abs(y2-y1); mx:=w/abs(x2-x1); x0:=1;
y0:=b-Abs(Round(y1*my)) ;
with form1.Canvas do
begin
// ???
MoveTo(l,b);LineTo(l,b-h);
MoveTo(x0,y0);LineTo(x0+w,y0);
TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3));
TextOut(l+5,b,FloatToStrF(y1,ffGeneral,6,3));
x:=x1; repeat y:=f(x);
Pixels[x0+Round(x*mx),y0-Round(y*my)]:=clRed;
x:=x+dx; until (x >= x2); end; end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Visible:=true;
GrOfFunc; end; end.
Dastur natijasi:
3-rasm y=x funksiyaning grafigi.
Y=sin2x Funksiya grafigini chizish
Dastur kodi va oynaning umumiy ko‘rinishini keltiramiz:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm} Function f(x:real):real;
begin
f:=Sin(x)* Sin(x) ; end;
procedure GrOfFunc;
var x1,x2:real; y1,y2:real; x:real; y:real; dx:real; l,b:integer; w,h:integer; mx,my:real;
x0,y0:integer;
begin
l:=10; b:=Form1.ClientHeight-20;
h:=Form1.ClientHeight-40; w:=Form1.Width-40;
x1:=0; x2:=25; dx:=0.01;y1:=f(x1); y2:=f(x1);
x:=x1; repeat
y := f (x); if y < y1 then y1:=y;
if y > y2 then y2:=y; x:=x+dx; until (x >= x2);
my:=h/abs(y2-y1); mx:=w/abs(x2-x1); x0:=1;
y0:=b-Abs(Round(y1*my)); with form1.Canvas do
begin
MoveTo(l,b);LineTo(l,b-h);
MoveTo(x0,y0);LineTo(x0+w,y0);
TextOut(l+5,b-h,FloatToStrF(y2,ffGeneral,6,3));
TextOut(l+5,b,FloatToStrF(y1,ffGeneral,6,3));
x:=x1; repeat y:=f(x);
Pixels[x0+Round(x*mx),y0-Round(y*my)]:=clRed;
x:=x+dx; until (x >= x2); end; end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Visible:=true; GrOfFunc;
end; end.
Dastur natijasi:
4-rasm. Y=sin2x funksiya grafigi
|
| |