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

            你似乎還是不會使用批處理文件和命令行參數喲~~
              回復  更多評論    
            亚洲国产成人精品女人久久久 | 久久精品国产免费一区| 国内精品久久国产大陆| 精品一区二区久久久久久久网站| 99久久国产综合精品五月天喷水| 亚洲精品成人久久久| 国产精品久久国产精品99盘| 国产精品久久久久久五月尺| 91久久精品国产91性色也| 久久99精品久久久久久不卡 | 伊人色综合久久天天| 亚洲精品无码久久毛片| 99精品久久精品| 99蜜桃臀久久久欧美精品网站| 久久精品18| 久久久网中文字幕| 午夜精品久久久久久| 2021少妇久久久久久久久久| 亚洲人成无码久久电影网站| 爱做久久久久久| 久久久久国产| 99久久精品日本一区二区免费| 99久久99久久| 久久久久久久久久久久中文字幕 | 久久免费视频网站| 亚洲国产二区三区久久| 久久www免费人成看片| 国内精品九九久久精品 | 一级A毛片免费观看久久精品| 久久亚洲私人国产精品vA| 久久99精品久久久久子伦| 久久综合亚洲色HEZYO社区| 久久久黄片| 人人狠狠综合久久亚洲| 一本久道久久综合狠狠躁AV| 久久精品国产99久久香蕉| 久久久精品久久久久久| 日产久久强奸免费的看| 99久久综合国产精品免费| 一本色道久久88综合日韩精品 | 久久亚洲精品视频|