SRL Archive - Help and Support

Help with finding greatest/least value in an array...


R0b0t1

2007-09-10 18:21:30

Is there a function for it? I believe I've seen one before…




Has to do with autocoloring.

Bobarkinator

2007-09-10 21:21:12

function ArrMin(I: TIntegerArray): Integer;
var
C: Integer;
begin
Result:= I[0];
for C:= 1 to Length(I) - 1 do
if(Result > I[C])then Result:= I[C];
end;

By Bullzeye. Just reverse it to find greatest.

R0b0t1

2007-09-10 22:16:36

Wow… That does not make since to me… But I guess if it works, I can disect it later.

bullzeye95

2007-09-10 22:22:29

It loops through the array holding the current lowest in a variable.

But I made that for somebody (forgot who) that couldn't use the SCAR function AMin. ;)

Bobarkinator

2007-09-11 08:07:11

Oh ya, n3ss3s couldn't use AMin and AMax.

Special Ed

2007-09-11 21:30:22

BubbleSortB if you wanted it sorted, then you could just use Array[0] for your result. AMax, and AMaxE work too… if you want to be simple… -.-; :p

bullzeye95

2007-09-11 23:59:41

Bubble sorting would take way longer with bigger arrays though.

n3ss3s

2007-09-12 05:04:54

Nowadays Im ofcourse a happy owner of Divi 3.11, o and Divi 3.06 had AMax but not AMin :p

R0b0t1

2007-09-12 17:25:32

Is there something to sort extended arrays…?

Special Ed

2007-09-12 19:39:35

From: r0b0t1
Is there something to sort extended arrays…?


Do you ever look through the SCAR Guide… :p
AMaxE will return the largest value in an extended Array, as for sorting it, I don't know if BubbleSort will work, you may have to devise your own function for that.

R0b0t1

2007-09-12 20:49:43

I do look in the guide, but am lazy sometimes….


I just solved the problem :p.

The Claw

2007-09-13 03:31:55

What do you mean by extended arrays?

Santa_Clause

2007-09-13 04:49:57

[Sarcastic] Noob! Don't you know what an extended array is?! [/Sarcastic]

Bobarkinator

2007-09-13 21:06:05

From: SantaClause
[Sarcastic] Noob! Don't you know what an extended array is?! [/Sarcastic]


Is that helping anything? You could have done the sarcastic quotes then told him.

Anyways, Claw like an array of Extended instead of Array of integer


program New;
{.include SRL\SRL.scar}
var
Extend: Array of Extended;
i: Integer;

begin
SetupSRL;
Extend:= [1.3,4.0,6.7,9.2];
for i:= 0 to GetArrayLength(Extend) -1 do
WriteLn(FloatToStr(Extend[i]));
end.

The Claw

2007-09-14 09:47:24

Ah right, seems pretty obvious now lol. Thanks for that.

Bobarkinator

2007-09-15 00:40:58

From: The Claw
Ah right, seems pretty obvious now lol. Thanks for that.


No problem, any time.