Boa tarde, gostaria de fazer uma função que varre uma matriz e ache um linha que contenha todos os elementos maior que da linha seguinte ou da linha anterior, basicamente é para testar todas com todas até encontrar a linha que tenha todos os elementos maior ou igual a outra linha.
fiz a função porém não estou tendo êxito. Se alguém puder me ajudar , desde já agradeço.
function mista(): string;
var
posI,posJ,i,j,l,k,cont:integer;
verifica: array of Boolean;
validado,achou: Boolean;
texto,resultado: string;
begin
achou := false;
validado:=true;
posI:=0;
SetLength(matrizAux,qtdLinha,qtdColuna);
SetLength(verifica,qtdColuna);
for i:=0 to qtdLinha-1 do //preenchendo a matriz aux
for j:=0 to qtdColuna-1 do
begin
matrizAux[i,j]:=matriz[i,j];
verifica[i]:= false;
end;
for i:= 0 to qtdLinha-1 do
for j:= 0 to qtdColuna-1 do
for l:=0 to qtdLinha-1 do
if not achou then
begin
for k:=0 to qtdColuna-1 do
begin
if not l=i then
begin
if (matriz[i,j]>= matrizAux[l,k]) then
begin verifica[i]:= true; end;
end;
end; // for K
cont:=0;
while validado do
begin
if verifica[cont] then
begin posI:= i; inc(cont); achou:=true; end
else
begin validado:= false; achou := false end;
end; //while
end //if do achou
else break;
if achou then
begin
for j:= 0 to qtdColuna-1 do
begin
texto:= texto + ''''+ inttostr(matrizAux[posI,j]);
end;
resultado:= texto;
end
else
resultado:= ''linha não encontrada'';
mista:= resultado;
end;