代码:
int StringToInt(char *hex)
{
return CharToInt(hex[]) * + CharToInt(hex[]);
} int CharToInt(char hex)
{
if (hex>='' && hex <='')
return hex - '';
if (hex>='A' && hex <= 'F')
return hex-'A'+;
if(hex>='a' && hex <= 'f')
return hex-'a'+;
return -;
}