Convert 60 seconds to 1:00(minutes to secons)
#8

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
Small improvement:

pawn Код:
ConvertToMinutes(time)
{
    new string[10], minutes, seconds;
    minutes = floatround(time / 60);
    seconds = floatround(time - minutes * 60);
    format(string, sizeof(string), "%02d:%02d", minutes, seconds);
    return string;
}
You don't need an if check there..
I still think this is the best solution. Except you can remove floatround as well. An integer divided by an integer yields an integer. Any decimals that would've come out in a "normal" calculation are simply dropped. Assuming our example from before, 330 / 60 would yield simply 5.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)