var Form1: TForm1; Labels: Array [0..6] of Tlabel;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); var i,j,k,a,b:integer; S,tmp:string; begin Labels[0]:=Label1; Labels[1]:=Label2; Labels[2]:=Label3; Labels[3]:=Label4; Labels[4]:=Label5; Labels[5]:=Label6; Labels[6]:=Label7; Randomize; i:=1+Random(35); S:=intToStr(i); labels[0].Caption:=S; for j:=1 to 6 do begin i:=1+Random(35); S:=intToStr(i); for k:=0 to (j-1) do begin if S=Labels[k].Caption then begin i:=1+Random(35); S:=intToStr(i); end; end; Labels[j].Caption:=S; end;
for a:=1 to 6 do begin for b:=0 to (a-1) do begin if StrToInt(labels[a].Caption)<StrToInt(Labels[b].Caption) then begin tmp:=Labels[a].Caption; Labels[a].Caption:=Labels[b].Caption; Labels[b].Caption:=tmp; end; end; end; end;