• <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

            五筆編碼查詢


              借用編碼表,查詢對應漢字的五筆編碼:

              小乓練題:
            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;     
                    }

                }
                
                
            // 循環查找相關漢字的編碼
                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"<<"無對應編碼"<<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 李現民 閱讀(455) 評論(0)  編輯 收藏 引用 所屬分類: 小乓練題

            亚洲国产精品无码久久98| 国产亚洲精品美女久久久| 久久精品国产亚洲麻豆| 777米奇久久最新地址| 国产精品久久久久久搜索| 亚洲色欲久久久综合网| 最新久久免费视频| 夜夜亚洲天天久久| 久久亚洲国产精品一区二区| 国内精品九九久久久精品| 久久99国产精品久久| 久久综合九色综合精品| 久久影院久久香蕉国产线看观看| 久久久久亚洲AV无码去区首| 模特私拍国产精品久久| 久久久久人妻一区二区三区vr| 品成人欧美大片久久国产欧美| 久久乐国产精品亚洲综合| 7777久久久国产精品消防器材| 国产精品99久久精品| segui久久国产精品| 国产精品99久久久久久宅男小说| 久久婷婷五月综合97色| 2022年国产精品久久久久| 久久婷婷五月综合97色直播| 久久久久亚洲AV无码网站| 久久久久99精品成人片牛牛影视| 狠狠色丁香久久婷婷综合| 狠狠色综合久久久久尤物| 色88久久久久高潮综合影院 | 狠狠色噜噜色狠狠狠综合久久 | 美女写真久久影院| 少妇无套内谢久久久久| 国内精品免费久久影院| 国产产无码乱码精品久久鸭| 亚洲伊人久久综合中文成人网| 精品久久久久久国产91| 伊人久久无码中文字幕| 久久99精品九九九久久婷婷| 久久国产精品成人片免费| 无码伊人66久久大杳蕉网站谷歌 |