Autor Beitrag
fablio
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

WIN XP
D7 Ent
BeitragVerfasst: Fr 30.05.03 16:02 
Hi

Ich habe ein array mit Integer Werten und möhte gerne im Array suchen, welche zahl im Array am nächsten bei einer Variable ist.

Welches ist die einfachste Lösung?

mfg

_________________
Der Optimist hofft, alles werde beim alten bleiben; der Pessimist befürchtet dies.
W. Saroyan
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Fr 30.05.03 19:54 
du musst mit for X:=0 to High(Array) das ganze Array durchsuchen und die entsprechenden If/else drinne haben.

so aus'm kopf:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  mVar: Integer;
  I:Integer;
...
for I:=0 to High(Array) do
  if mVar= Array[I] then {do something}
...

grez
msch