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

            哇哦~這就是我

            This is my way ~
            <2008年4月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            統計

            • 隨筆 - 10
            • 文章 - 0
            • 評論 - 2
            • 引用 - 0

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            C++第五次上機作業

             

            #include<iostream>
            #include
            <sstream>
            #include
            <map>
            #include
            <string>
            #include
            <vector>
            #include
            <iomanip>
            #include
            <fstream>
            using namespace std;
            typedef map
            < string , vector<int> > WORD;
            void init ( WORD 
            & m )
            {
             ifstream fin;
             fin.open(
            "keywords.txt");
                
            string keyword;
                
            while ( fin>>keyword )
                    m[keyword];
             fin.close();
            }
            void count ( WORD 
            & m )
            {
                
            int line=0;
             ifstream fin;
             fin.open(
            "text.txt");
                
            string str;
                
            while ( getline(fin,str) )
                {
                    stringstream SS(str);
                    line
            ++;
                    
            while(SS>>str)
                    {
                        
            if ( m.find(str)!=m.end() )
                            m[str].push_back (line);
                    }
                }
             fin.close();
            }
            void output ( WORD m )
            {
                
            string keyword;
                
            for ( WORD::iterator iter_map=m.begin() ; iter_map!=m.end() ; iter_map++ )
                {
                    cout
            <<setw(10)<<iter_map->first<<":"
                        
            <<"(";
                    
            for ( vector<int>::iterator iter_vector=iter_map->second.begin() ; iter_vector!=iter_map->second.end(); iter_vector++ )
                    {
                        
            if ( iter_vector!=iter_map->second.begin() )
                            cout
            <<",";
                        cout
            <<*iter_vector;
                    }
                    cout
            <<")"<<endl;
                }
            }
            int main  ()
            {
                WORD m;
                init(m);
                count(m);
                output(m);
            }

            posted on 2008-04-03 23:10 chinaeli 閱讀(325) 評論(1)  編輯 收藏 引用

            評論

            # re: C++第五次上機作業 2008-04-05 23:15 一個你的同學

            你似乎還是不會使用批處理文件和命令行參數喲~~
              回復  更多評論    
            91精品国产91久久久久久青草| 国产视频久久| 久久99热这里只有精品国产| 久久中文字幕人妻熟av女| 久久SE精品一区二区| 精品国产青草久久久久福利| 久久久久亚洲AV成人片| 久久久国产视频| 久久99国产综合精品女同| 久久久久99精品成人片三人毛片| 亚洲国产成人久久综合区| 久久妇女高潮几次MBA| 久久精品国产精品亚洲精品 | 国产高潮国产高潮久久久| 久久综合九色综合网站| 性欧美大战久久久久久久| 久久婷婷五月综合色奶水99啪 | 久久AV高清无码| 国产三级久久久精品麻豆三级| 久久综合日本熟妇| 亚洲精品高清国产一线久久| 久久久久女人精品毛片| 日产久久强奸免费的看| 久久久久久午夜成人影院| 久久久久久噜噜精品免费直播| 久久99热这里只频精品6| 国产精品一久久香蕉国产线看观看| 亚洲AV日韩AV永久无码久久| 亚洲国产精品婷婷久久| 日韩精品久久久肉伦网站 | 亚洲愉拍99热成人精品热久久| 精品久久久久久久久午夜福利| 超级碰久久免费公开视频| 狠狠干狠狠久久| 久久精品国产99国产精偷| 思思久久好好热精品国产| 亚洲中文字幕无码久久2017| 国产精品成人久久久| 久久亚洲AV无码精品色午夜| 久久亚洲国产精品123区| 久久WWW免费人成—看片|