highest_value = Max ( value1, value2 [,value3...] )
With at least up to 16 values or infinitive if possible...
PHP has this function:
http://www.php.net/manual/en/function.max.php
highest_value = Max ( value1, value2 [,value3...] )
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
highest_value = Max ( value1, value2 [,value3...] )
I like logic, hence I dislike humans but love computers.
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact:
Hi,
Here is a solution.
Best regards
Wolf
Here is a solution.
Code: Select all
Procedure MaxLong ( *Array.LONG )
Protected *EOA = *Array + PeekL ( *Array - 8 ) * SizeOf ( LONG )
Protected lHighest.l = 0
While *Array < *EOA
If lHighest < *Array\l
lHighest = *Array\l
EndIf
*Array + SizeOf ( LONG )
Wend
ProcedureReturn lHighest
EndProcedure
Dim test.l ( 7 )
test.l ( 0 ) = 5
test.l ( 1 ) = 8
test.l ( 2 ) = 1
test.l ( 3 ) = 7
test.l ( 4 ) = 5
test.l ( 5 ) = 9
test.l ( 6 ) = 2
test.l ( 7 ) = 3
Debug MaxLong ( @ test () )
Wolf
@Wolf,
Using SortArray(test(), #PB_Sort_Descending) is easier
Using SortArray(test(), #PB_Sort_Descending) is easier

Code: Select all
Dim test.l ( 7 )
test.l ( 0 ) = 5
test.l ( 1 ) = 8
test.l ( 2 ) = 1
test.l ( 3 ) = 7
test.l ( 4 ) = 5
test.l ( 5 ) = 9
test.l ( 6 ) = 2
test.l ( 7 ) = 3
SortArray(test(), #PB_Sort_Descending)
Debug test (0)
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
- Hroudtwolf
- Addict
- Posts: 803
- Joined: Sat Feb 12, 2005 3:35 am
- Location: Germany(Hessen)
- Contact: