Delphi dasturida massivlar bilan ishlash Massivlarning toifalanishi Massivlar ustida amallar



Yüklə 170,86 Kb.
səhifə3/9
tarix01.05.2023
ölçüsü170,86 Kb.
#105429
1   2   3   4   5   6   7   8   9
2 mavzu DELFI DASTURLASH TILIDA MASSIVLAR

Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure StringGrid1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const
k=5;
var
a:array[1..k]of integer;
min:integer;
i:integer;
begin
for i:=1 to k do
a[i]:=StrToInt(StringGrid1.Cells[i-1,0]);
min:=1;
for i:=2 to k do
if a[i]< a[min]then min:=i;
label2.caption:='Eng kichchik elimenti:'
+IntToStr(a[min])+#13+'Eliment nomeri:'+ IntToStr(min);
end;
procedure TForm1.StringGrid1Click(Sender: TObject);
var Key: Char;
begin
case Key of
#8,'0'..'9': ;
#13:
if StringGrid1.Col < StringGrid1.ColCount-1
then StringGrid1.Col:= StringGrid1.Col + 1;
else key := Chr(0);
end;
end;
end.


Misol. massiv elementlarini satr bo‘yicha tartiblash dasturini tuzing.
Masala yechish oynasi va mos dastur modulini keltiramiz.



8-rasm
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Yüklə 170,86 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin