zoukankan      html  css  js  c++  java
  • 123

    void chToInt(char t, unsigned int & tt)
    {
    switch (t)
    {
    case '0':
    tt = 0;
    break;
    case '1':
    tt = 1;
    break;
    case '2':
    tt = 2;
    break;
    case '3':
    tt = 3;
    break;
    case '4':
    tt = 4;
    break;
    case '5':
    tt = 5;
    break;
    case '6':
    tt = 6;
    break;
    case '7':
    tt = 7;
    break;
    case '8':
    tt = 8;
    break;
    case '9':
    tt = 9;
    break;
    case 'a':
    tt = 10;
    break;
    case 'b':
    tt = 11;
    break;
    case 'c':
    tt = 12;
    break;
    case 'd':
    tt = 13;
    break;
    case 'e':
    tt = 14;
    break;
    case 'f':
    tt = 15;
    break;
    default:
    break;
    }
    }

    void IntToChar(unsigned int t, char & tt)
    {
    switch (t)
    {
    case 0:
    tt = '0';
    break;
    case 1:
    tt = '1';
    break;
    case 2:
    tt = '2';
    break;
    case 3:
    tt = '3';
    break;
    case 4:
    tt = '4';
    break;
    case 5:
    tt = '5';
    break;
    case 6:
    tt = '6';
    break;
    case 7:
    tt = '7';
    break;
    case 8:
    tt = '8';
    break;
    case 9:
    tt = '9';
    break;
    case 10:
    tt = 'a';
    break;
    case 11:
    tt = 'b';
    break;
    case 12:
    tt = 'c';
    break;
    case 13:
    tt = 'd';
    break;
    case 14:
    tt = 'e';
    break;
    case 15:
    tt = 'f';
    break;
    default:
    break;
    }
    }

    int main()
    {
    int num = 0;
    cin >> num;
    string mystr = " ";
    getline(cin, mystr);

    int i = 0;
    vector<string> strVec;
    while (i < num)
    {
    string strbuf;
    getline(cin, strbuf);
    strVec.push_back(strbuf);
    i ++;
    }

    for (int j = 0; j < strVec.size(); j++)
    {
    string em = strVec[j];
    int emSize = em.size();
    string tmp;
    for (int k = (emSize - 1); k >= 0; k--)
    {
    char t = em[k];
    unsigned int tt = 0;
    chToInt(t, tt);
    unsigned char aftertt = 0;
    for (int n = 3; n >= 0; n--)
    {
    aftertt = (aftertt | (((tt >> n) & 0x01) << (3 - n)));
    }
    aftertt = (~aftertt) & 0x0F;
    char afterChar;
    IntToChar(aftertt, afterChar);
    tmp = tmp + afterChar;
    }
    printf("%s ", tmp.c_str());
    }

    return 0;
    }

  • 相关阅读:
    ExtJS 4布局
    ExrJS4学习笔记1 类
    Jquery实现动态添加按钮
    ExtJs 4 MVC
    读取目录下所有目录和文件加载到TreeView
    利用List的Sort()、Find()、FindAll()、Exist()來解決一些問題
    html常用
    ExtJs3.3 TreePanel,checked节点和平常节点同时存在
    sql server 常用查询
    美女时钟网页代码
  • 原文地址:https://www.cnblogs.com/weiyouqing/p/12758320.html
Copyright © 2011-2022 走看看