5 numbers in a row
#1

Hi,


How to find and check if there is highest 5 numbers in row if i have that:

Код:
60
100
5
19
50
66
52
58
42
30
69
40
36
49
48
13
47
46
45
And how you see there is 45 46 47 48 49 50 in row and highest. But how to script that, because numbers will be random.
Reply
#2

http://forum.sa-mp.com/showpost.php?...postcount=1737
Reply
#3

But i need from highest to lowest.
Reply
#4

Quote:
Originally Posted by Banditukas
Посмотреть сообщение
But i need from highest to lowest.
Use the sort function given in the link above and loop backwards to achieve that.
like this :
PHP код:
new
    array[] = { -
541, 54, 689, 12, 3, 0, 3, 55, 66, -541, 5468484, -564, 1554, 1656 }
;
quickSort(array, 0, sizeof(array) - 1);//Fuction code in above link
    
for(new i = (sizeof(array)-1); i >= 0; i--)//loop backwards
{
    
printf("%d", array[i]);
} 
Output:
Quote:
5468484
1656
1554
689

...and so on
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)