• <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 ~
            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            統計

            • 隨筆 - 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 一個你的同學

            你似乎還是不會使用批處理文件和命令行參數喲~~
              回復  更多評論    
            久久SE精品一区二区| yy6080久久| 狠狠精品久久久无码中文字幕| 久久精品国产亚洲综合色| 国产日韩久久免费影院| 亚洲国产精品无码久久久久久曰 | 中文字幕成人精品久久不卡| 91麻精品国产91久久久久| 精品国产日韩久久亚洲| 91久久精品视频| 久久精品国产网红主播| 日韩久久无码免费毛片软件| 久久无码人妻一区二区三区| 久久久久久噜噜精品免费直播| 熟妇人妻久久中文字幕| 欧美成a人片免费看久久| 久久精品国产清高在天天线| 久久久久国产精品三级网| 久久久中文字幕| 久久久久久久久无码精品亚洲日韩 | 精品国产乱码久久久久久呢| 久久精品一区二区国产| 中文国产成人精品久久不卡| 久久国产成人| 超级碰久久免费公开视频| 久久精品国产亚洲AV电影| 久久精品国产清自在天天线| 午夜精品久久久久久久无码| 欧美综合天天夜夜久久| 精品永久久福利一区二区| 青青草原精品99久久精品66| 国色天香久久久久久久小说| 色婷婷狠狠久久综合五月| 久久久久亚洲AV成人网人人网站 | 一级做a爰片久久毛片看看| 国产精品欧美久久久久无广告| 国产成人精品久久免费动漫| 久久精品无码一区二区无码| 色88久久久久高潮综合影院 | 亚洲精品无码久久久久去q| 久久精品国产免费观看|