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;
    }

  • 相关阅读:
    Linux套接子(c语言)模拟http请求、应答
    709. 转换成小写字母
    1108. IP 地址无效化
    C++大作业——教职工管理系统
    贪吃蛇游戏 1.0
    getch()函数的使用方法及其返回值问题
    Open source project code
    slack Interface operation
    slack init: Simple interaction with slack bot
    mac 使用 Docker 搭建 ubuntu 环境
  • 原文地址:https://www.cnblogs.com/pbreak/p/1759562.html
Copyright © 2011-2022 走看看