[Pedido] Color Hexadecimal to Decimal
#4

Se precisar da entrada por corda(string).
pawn Код:
stock HexToInt(string[])
{
    if (string[0] == 0)
    {
        return 0;
    }
    new i;
    new cur = 1;
    new res = 0;
    for (i = strlen(string); i > 0; i--)
    {
        if (string[i-1] < 58)
        {
            res = res + cur * (string[i - 1] - 48);
        }
        else
        {
            res = res + cur * (string[i-1] - 65 + 10);
            cur = cur * 16;
        }
    }
    return res;
}
Reply


Messages In This Thread
Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 10:13
Re: Color Hexadecimal to Decimal - by PT - 17.08.2014, 10:40
Re: Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 10:54
Re: Color Hexadecimal to Decimal - by Schocc - 17.08.2014, 11:14
Re: Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 11:21
Re: Color Hexadecimal to Decimal - by Schocc - 17.08.2014, 12:32
Re: Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 12:49
Re: Color Hexadecimal to Decimal - by Schocc - 17.08.2014, 12:56
Re: Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 14:00
Re: Color Hexadecimal to Decimal - by VeNuZ_ - 17.08.2014, 19:56

Forum Jump:


Users browsing this thread: 1 Guest(s)