well, what you need to do is a simple "bubblesort"
pawn Код:
new UZWE[] = {100,34,2,1124,3642,234,3563,22,51,35};//filling ur array with example values
new tmp;
for (new n=sizeof UZWE; n>1; n=n-1)
{
for (new i=0; i<n-1; i=i+1)
{
if (UZWE[i] < UZWE[i+1])
{
tmp = UZWE[i+1];
UZWE[i+1] = UZWE[i];
UZWE[i] = tmp;
}
}
}
now print it and it'll look like this:
PHP код:
Array ( [0] => 3642 [1] => 3563 [2] => 1124 [3] => 234 [4] => 100 [5] => 51 [6] => 34 [7] => 22 [8] => 2 [9] => 35 )
after that, its sorted from biggest to smallest so you just have to "echo" it in a loop from 0 - 9
or just the ftop 3, it's your choice
example code
php (for nicer looking output)
PHP код:
<?php
$UZWE = array(100,34,2,1124,3642,234,3563,22,51,35);
$tmp;
print_r($UZWE);
echo "<br><br>";
for ($n=count($UZWE)-1; $n>1; $n=$n-1)
{
for ($i=0; $i<$n-1; $i=$i+1)
{
if ($UZWE[$i] < $UZWE[$i+1])
{
$tmp = $UZWE[$i+1];
$UZWE[$i+1] = $UZWE[$i];
$UZWE[$i] = $tmp;
}
}
}
print_r($UZWE);
?>
will generate:
PHP код:
Array ( [0] => 100 [1] => 34 [2] => 2 [3] => 1124 [4] => 3642 [5] => 234 [6] => 3563 [7] => 22 [8] => 51 [9] => 35 )
Array ( [0] => 3642 [1] => 3563 [2] => 1124 [3] => 234 [4] => 100 [5] => 51 [6] => 34 [7] => 22 [8] => 2 [9] => 35 )