Quote:
Originally Posted by Konstantinos
pawn Код:
ReturnMax(&count, const string[], len) { count = 0; new max_val = -1; for (new i; i != len; ++i) { if (string[i] > max_val) { max_val = string[i]; count = 1; } else if (string[i] == max_val) ++count; } return max_val; }
An example:
pawn Код:
test[0] = 44; test[1] = 11; test[2] = 44;
new count, value = ReturnMax(count, test, sizeof (test)); printf("%i %i", count, value);
It will print 2 (2 indexes with the highest number) and 44 (the highest number).
|
haha, Thanks, but at the end this wasn't what I needed.
I needed it to return ID of the highest.
Edited a bit.
Thanks anyways.