|
|
səhifə | 3/9 | tarix | 01.05.2023 | ölçüsü | 170,86 Kb. | | #105429 |
| 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,
Dostları ilə paylaş: |
|
|