进制转换,就这样。。。
struct udiv_t
{
unsigned int quot;
unsigned int rem;
};
udiv_t div(unsigned int a, unsigned b)
{
udiv_t c;
c.quot = a / b;
c.rem = a % b;
return c;
}
vector<unsigned int> dec2anyhex(unsigned int ori, unsigned int anyhex)
{
vector<unsigned int> numarray;
udiv_t d = div(ori, anyhex);
numarray.push_back(d.rem);
while (d.quot != 0)
{
d = div(d.quot, anyhex);
numarray.push_back(d.rem);
}
return numarray;
}