• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            清風竹林

            ぷ雪飄絳梅映殘紅
               ぷ花舞霜飛映蒼松
                 ----- Do more,suffer less

            五筆編碼查詢


              借用編碼表,查詢對應(yīng)漢字的五筆編碼:

              小乓練題:
            int main(int argc, char* argv[]) 
            {
                
            if (argc==1)
                {
                    std::cout
            <<"用法: wubi <需要查詢編碼的漢字>"<<std::endl;
                    
            return 0;
                }
                
            // 文件路徑
                char* szPath = "wubi.txt";

                std::ifstream fin(szPath);
                
            if (!fin)
                {
                    std::cout
            <<"無法打開五筆編碼文件,文件名wubi.txt,請置于wubi.exe同目錄中"<<std::endl;
                    
            return -1;
                }
                
            // 通常我們這樣讀取一個文本文件的全文
                std::string strText = std::string(std::istreambuf_iterator<char>(fin), std::istreambuf_iterator<char>());


                typedef std::map
            <std::string, std::string> WubiMap;
                WubiMap wubiMap;

                
            int nLength = strText.length();
                
            int nLeft = 0;
                
            int nRight = -1;

                
            // 讀入五筆編碼
                std::string strWord; 
                std::
            string strCode; 
                
            while(nRight < nLength)
                {
                    nLeft 
            = nRight+1;
                    nRight 
            = nLeft+1;
                    
            //tab前的部分為key:strWord
                    while (nRight<nLength && strText[nRight] != '\t')
                    { 
                        nRight
            ++;
                    }
                    
            if(nRight < nLength)
                    {
                        strWord 
            = strText.substr(nLeft, nRight - nLeft);
                    }

                    nLeft 
            = nRight + 1;
                    nRight 
            = nLeft + 1;
                    
            //回車前的為Code
                    while (nRight<nLength && strText[nRight] != '\n')
                    {
                        nRight
            ++;
                    }
                    
            if(nRight < nLength)
                    {
                        strCode 
            = strText.substr(nLeft, nRight - nLeft);
                        wubiMap[strWord]
            = strCode;     
                    }

                }
                
                
            // 循環(huán)查找相關(guān)漢字的編碼
                std::string strLine=argv[1];
                nLength
            = strLine.length();
                
            for (int i=0; i<nLength; ++i)
                {
                    
            // 判斷是漢字的前半部分
                    if (strLine[i]<0)
                    {
                        strWord
            = strLine.substr(i, 2);
                        std::cout
            <<strWord<<"\t"<<wubiMap[strWord]<<std::endl;
                        
            ++i;
                    }
            else
                    {
                        std::cout
            <<strLine[i]<<"\t"<<"無對應(yīng)編碼"<<std::endl;
                    }
                }

                
            return 0;
            }

              示例:
            D:\>wubi 我是一本書
             我  trnt
             是  jghu
             一  ggll
             本  sgd
             書  nnhy

            附:python解決方案一個:
            import sys

            wbx
            ={
            '':'aaaa',
            '':'aad',

            '':'yywf',
            '':'yyyy',
            '':'ttgg',
            '':'gii'}

            if len(sys.argv)==1:
                
            print('wubi <需要查找五筆編碼的漢字>')
                sys.exit(
            1)
            argv
            =sys.argv[1:]
            for line in argv:
                
            for c in line:
                    
            if c in wbx:
                        
            print(' %s  %s'%(c, wbx[c]))
                    
            elif ord(c)<128 or c in ',。!~“”?':
                        
            print(' %s'%c)
                    
            else:
                        
            print(' %s  -->編碼缺失'%c)

            附:五筆編碼表一張: wubi.7z


              小乓加油 :D

             

            posted on 2008-11-20 16:54 李現(xiàn)民 閱讀(473) 評論(0)  編輯 收藏 引用 所屬分類: 小乓練題

            久久免费视频观看| 国产精品久久久久久影院| 久久久久无码精品| 免费无码国产欧美久久18| 久久精品中文无码资源站| 伊人久久综合热线大杳蕉下载| 欧美与黑人午夜性猛交久久久| 狠狠色婷婷久久一区二区三区| 久久99精品国产一区二区三区 | 久久久国产精品福利免费| 久久久久久久综合日本| 高清免费久久午夜精品| 无码国内精品久久综合88| 国产91久久综合| 精品久久久久久无码专区| 日本五月天婷久久网站| 久久99热这里只有精品国产| 国产精品九九九久久九九| 欧美一区二区三区久久综| 久久综合久久伊人| 国产精品久久久久久久午夜片| 国产情侣久久久久aⅴ免费| 久久久久久精品成人免费图片| 欧美粉嫩小泬久久久久久久 | 久久精品国产2020| 久久人做人爽一区二区三区| 日韩美女18网站久久精品| 国产精品女同一区二区久久| 久久综合丝袜日本网| 99久久国产综合精品五月天喷水 | 中文字幕久久欲求不满| 国产精品美女久久久| 久久精品国产91久久综合麻豆自制| 亚洲va国产va天堂va久久| 性做久久久久久久| 久久99国产乱子伦精品免费| WWW婷婷AV久久久影片| 狠狠干狠狠久久| 久久91精品综合国产首页| 久久黄视频| 精品久久亚洲中文无码|