Topshiriqni bajarish namunasi.
Bu yerda:
x[0.2;0.4], x ning o‘zgarish qadami hx=0.1, a=2.3
2. Topshiriqning algoritm blok-shemasi.
3. Algoritm asosida tuzilgan dasturi.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Panel3: TPanel;
Button1: TButton;
Button2: TButton;
Panel4: TPanel;
Label1: TLabel;
Panel2: TPanel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const a=4; b=3;
var
Form1: TForm1;
x,y: real;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:=‘‘;
x:=0.2;
repeat
if x>0.3 then y:=exp(1/5*ln(x+a)) else
if x=0.3 then y:=x else
y:=cos(x-a);
label1.Caption:=label1.Caption+ ‘x=‘+floattostr(x)+’ y=‘+floattostr(y)+#13;
x:=x+0.1;
until x>0.4;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.
Do'stlaringiz bilan baham: |