09.10.2011, 03:17
NEW FUNCTION
OLD FUNCTION
Example 1
Untested this little example though should work!
Example 1
Untested this little example though should work!
If I did something wrong, tell me
PS.
We're on
pawn Код:
stock Float: Pythagoras2(Float: val1, Float: val2, bool: shortside = false)
return shortside == true ? (floatsqroot(floatsub(floatmul(val1, val1), floatmul(val2, val2)))) : (floatsqroot(floatadd(floatmul(val1, val1), floatmul(val2, val2))));
pawn Код:
stock Pythagoras(Float: val1, Float: val2, bool: shortside = false)
{
new
Float: cal
;
if(shortside) cal = ((val1 * val1) - (val2 * val2));
else cal = ((val1 * val1) + (val2 * val2));
cal = floatsqroot(cal);
return cal;
}
Example 1
pawn Код:
new Float: X = Pythagoras(90, 20, false);
printf("The hypotenuse of this is %f", X);
Example 1
pawn Код:
new Float: X = Pythagoras(56, 20, true);
printf("The height of this is %f", X);
If I did something wrong, tell me
PS.
We're on
pawn Код:
new page[256];