| Lucas_Octavian_1994 a întrebat:

Am nevoie de ajutor am rezolvat ceva, dar nu stiu cum sa continui!(delphi)
Folosind componenta STRINGRID completați un tabel cu n linii și n coloane cu valori
aleatorii din intervalul 0.100. Determinați elementele maximale de pe fiecare linie
adăugați la STRINGRID o coloană în care scrieți valorile determinate.

1 răspuns:
| Lucas_Octavian_1994 explică:

Procedure TForm1.btn1Click(Sender: TObject);
begin
n:=StrToInt(edt1. text);
strngrd1.RowCount:=n;
strngrd1.ColCount:=n;

Randomize;
for i:=0 to n-1 do
for j:=0 to n-1 do
begin
t[i, j]:=Random(100);
strngrd1. Cells[j, i]:=IntToStr(t[i, j]);
end;
min:=StrToInt(strngrd1. Cells[1, 1]);

for i:=0 to n-1 do
for j:=0 to n-1 do
if i=j then begin
if min>StrToInt(strngrd1. Cells[j, i]) then min:=StrToInt(strngrd1. Cells[j, i]); end;
lbl2.caption:='Minim='+inttostr(min);


end;