Get the Biggest number?
#1

When i have this for example:

Код:
new Float:Test[10][1] = {
{0},
{0},
{7},
{1},
{8},
{4},
{2},
{3},
{3},
{8}
};
How can i get the bigest number out of it?







I though of something like this, but would that work?
Код:
GetBigestNumber()
{
	new number;
	for(new k; k < MAX_MAPS; k++)
	{
		for(new d; d < MAX_MAPS; d++)
		{
			if(Test[k] >= Test[d]) number = Test[k];
		}
	}
	return number;
}
Reply
#2

pawn Код:
GetBiggestNumber()
{
    new number;
    for(new k; k < sizeof(Test); k++)
    {
        if(Test[k] > number) number = Test[k];
    }
    return number;
}
Reply
#3

Quote:
Originally Posted by MadeMan
pawn Код:
GetBiggestNumber()
{
    new number;
    for(new k; k < sizeof(Test); k++)
    {
        if(Test[k] > number) number = Test[k];
    }
    return number;
}
Yes thanks, but what if there are 2 number the same hight, or all numbers are 0 (zero)?
Reply
#4

What about it?
Reply
#5

Quote:
Originally Posted by MadeMan
What about it?
i think Wackox Means:

When the round has ended, The players need to choose a new map.
What if 2 maps are Both voted 5 times, What will happen Then?
or nobody vote, and all the maps are voted 0 times, What will happen then?

Sorry for bad English, Iam dutch :P
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)