type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const n=10;
procedure shig'ariw;
var
i:integer;
begin
for i:=1 to n do
Memo1.Lines.add('5');
end;
begin
Shig'ariw; Memo1.Lines.add(' ekranda 10 dana bes');
Shig'ariw; Memo1.Lines.add(' ekranda 20 dana bes');
end;
end.
3.6.1-suwret. 5 tsifrdi shig'ariwshi programma.
3-masele. n! Di esaplaw programmasin duzin'.
Programma kodi ha'm aynanin' uliwmaliq korinisin keltiremiz:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
n: integer; y: integer;
function fact(m: integer): integer;
var
k: integer;
begin
if m=0 then fact:=1 else fact:=fact(m-1) * m;
end;
begin
n:=strtoint(edit1.Text);
y:= fact(n);
Memo1.Lines.add('Natiyje='+inttostr(y));
end;
end.
3.6.2-suwret. 1 den n ge deyin bolgan tsifrlardin' kobeymesi
Izoh: berip bolg'an programmada paydalanip faktariyaldi esaplawin'iz mumkin. Bunin' ushin joqari bolimine manis kiritip, esaplaw tuymesin saylasaq boldi.
4-misol. funksiyani araliqda qadem menen esaplaw programmasin duzin'.
Programma kodi ha'm aynanin' uliwmaliq korinisin keltiremiz:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:real;
procedure bolim programma(x:real);
var
y:real;
begin
y:=x+4;
Memo1.Lines.add('Tub son='+floattostr(y));
end;
begin
i:=-2;
repeat
Bolim programma(i); i:=i+1;
until i=10;
end; end.
3.6.3-suwret. Protsedurag'a baylanisli masele.
5-masele. Tomendegi figurani maydanin esaplaymiz.
3.6.1-sizma.
Programma kodi ha'm aynanin' uliwmaliq korinisin ko'restip otemiz:
unit Unit1;
Do'stlaringiz bilan baham: |