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

            你似乎還是不會使用批處理文件和命令行參數喲~~
              回復  更多評論    
            久久精品二区| 奇米影视7777久久精品人人爽| 亚洲AV无码1区2区久久| 狠狠色丁香久久婷婷综合| 性欧美大战久久久久久久久| 久久青青草原精品国产| 99久久亚洲综合精品成人| 精品多毛少妇人妻AV免费久久 | 精品国产乱码久久久久软件| 日本精品久久久久影院日本| 女人高潮久久久叫人喷水| 久久久久高潮毛片免费全部播放| 国产99久久久国产精免费| 欧美激情一区二区久久久| 国产精品99久久久久久宅男| 日本久久久久亚洲中字幕| 久久免费香蕉视频| 国产精品久久波多野结衣| 国产精品99久久久精品无码| 精品久久久久国产免费| 狠狠久久亚洲欧美专区| 亚洲成av人片不卡无码久久| 久久美女人爽女人爽| 国产精品禁18久久久夂久| 久久综合亚洲色一区二区三区| 女人香蕉久久**毛片精品| 国产综合久久久久久鬼色| 午夜久久久久久禁播电影| 一级a性色生活片久久无| 久久精品国产第一区二区| 免费观看久久精彩视频| 久久久久久无码Av成人影院| 18岁日韩内射颜射午夜久久成人| 久久男人中文字幕资源站| 久久精品国产99国产精品| 国内精品久久久久久久久电影网| www.久久热.com| 99久久成人18免费网站| 精品免费久久久久国产一区| 久久99亚洲综合精品首页| 久久久久18|