Need advanced help.
#1

Could someone point me to the right direction about this.

How to arrange variables by their values.

Like

Stat[0] = 3;
Stat[1] = 5;
Stat[2] = 1;
Stat[3] = 6;

how to arrange them by max, so result is something like this:

Stat[3] = 6;
Stat[1] = 5;
Stat[0] = 3;
Stat[2] = 1;


Right now Im trying with two loops by getting max and comparing if others is bigger, but no success.. :S
Reply
#2

I think you're doing the right thing.. Make a loop and check the bigger value and so on..
Can you show what you've tried..
Reply
#3

pawn Код:
new highest[8];
for(new d; d < sizeof(Karters); d++)
{
    for(new s; s < sizeof(KartCPs); s++)
    {
        if(KartCollected[d][s] == 0) { highest[d] = s; continue; }//Getting most collected items at s
    }
}
for(new m; m < sizeof(highest); m++)
{
    for(new n; n < sizeof(highest); n++)
    {
        if(highest[m] >= highest[n]) { pos[m] = n; }//Comparing
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)