zoukankan      html  css  js  c++  java
  • 16进制(字符串)转换成2进制(字符串)

    CString myProject::Convert16To2(CString strSource)
    {
       //转换成大写字母
       strSource.MakeUpper();
       CString strDest;
       for( int i = 0;i < strSource.GetLength();i++ )
       {
          if(strSource.GetAt(i) == '0')
            strDest += _T("0000");
          if(strSource.GetAt(i) == '1')
             strDest += _T("0001");
          if(strSource.GetAt(i) == '2')
             strDest += _T("0010");
          if(strSource.GetAt(i) == '3')
             strDest += _T("0011");
          if(strSource.GetAt(i) == '4')
             strDest += _T("0100");
          if(strSource.GetAt(i) == '5')
             strDest += _T("0101");
          if(strSource.GetAt(i) == '6')
             strDest += _T("0110");
          if(strSource.GetAt(i) == '7')
             strDest += _T("0111");
          if(strSource.GetAt(i) == '8')
             strDest += _T("1000");
          if(strSource.GetAt(i) == '9')
             strDest += _T("1001");
          if(strSource.GetAt(i) == 'A')
             strDest += _T("1010");
          if(strSource.GetAt(i) == 'B')

           strDest += _T("1011");
          if(strSource.GetAt(i) == 'C')
             strDest += _T("1100");
          if(strSource.GetAt(i) == 'D')
             strDest += _T("1101");
          if(strSource.GetAt(i) == 'E')
             strDest += _T("1110");
          if(strSource.GetAt(i) == 'F')
             strDest += _T("1111");
       }
       return strDest;
    }

  • 相关阅读:
    vector容器(一)
    螺旋数组实现
    zigzag数组实现
    HDU 1496
    HDU 1381 Crazy Search
    什么叫软核,固核,硬核?
    “杜拉拉思维模式”之六:小组面试提升术
    硬件工程师电路设计必须紧记的十大要点
    面试的“群殴”宝典
    三段式状态机 [CPLD/FPGA]
  • 原文地址:https://www.cnblogs.com/pbreak/p/1759562.html
Copyright © 2011-2022 走看看