Como pego 6 variaveis numéricas e vejo qual a maior? Estou usando este codigo, mas não mostra o valor verdadeiro:
procedure TForm1.moda; var maior : real; fi : array[1..6] of real; begin fi[1]:= strtofloat(fi1.text); fi[2]:=strtofloat(fi2.text); fi[3]:=strtofloat(fi3.text); fi[4]:=strtofloat(fi4.text); fi[5]:=strtofloat(fi5.text); fi[6]:=strtofloat(fi6.text); maior:= 0; if fi[1] > maior then maior:=1; if fi[2] > maior then maior:=2; if (fi[3]) > maior then maior:= 3; if (fi[4]) > maior then maior:=4; if (fi[5]) > maior then maior:=5; if (fi[6]) > maior then maior:=6; showmessage(floattostr(maior)); end;
O resultado que aparece na showmessage eh sempre 5!
Podem me ajudar? Ah, e tipo, isso ae tah em delphi, mas se alguem coloca o codigo em qualquer otra linguagem tah blz, q eu entendo! O q naum to conseguindo eh a logica! Vlw!