There is a matrix (two-dimensional array), which is displayed in a StringGrid. It is necessary for each row of the matrix to determine the number of negative elements.
I tried to write like this myself, but gives the error "range check error":
procedure TForm1.N8Click(Sender: TObject); var d: integer; begin for i:=0 to m do //счет идет с ноля for j:=0 to n do x[i,j]:=StrToFloat(StringGrid1.Cells[j,i]); m:=strtoint(edit1.Text); n:=strtoint(edit2.Text); for i:=0 to m do begin d:=0; for j := 0 to n do if x[i,j]<0 then d:=d+1; StringGrid2.Cells[0,j]:= FormatFloat('0.',d); end; end; 