10转16进制 进制转2进制

CString CSFCApp::DecToHex(int iSource)
{
CString str;
str.Format(_T("%X"), iSource);
return str;
}

 

 

void CSFCApp::DecToBin(CString strSource, CUIntArray *IntAry)
{
IntAry->RemoveAll();
if(!IsNum(strSource)) return;
int iSource = atoi(strSource);
while(iSource>=2)
{
int k = iSource%2;
iSource/=2;
IntAry->Add(k);
}
IntAry->Add(iSource);
}

posted @ 2019-08-16 17:18  石首桃花山  阅读(149)  评论(0编辑  收藏  举报