• <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 閱讀(336) 評論(1)  編輯 收藏 引用

            評論

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

            你似乎還是不會使用批處理文件和命令行參數喲~~
              回復  更多評論    
            久久精品国产免费| 99久久精品国内| 亚洲色婷婷综合久久| 天天躁日日躁狠狠久久| 99久久99久久精品国产片果冻| 色播久久人人爽人人爽人人片aV| 四虎亚洲国产成人久久精品| 欧美黑人又粗又大久久久| 久久久久久久久久免免费精品| 国产精品99久久久精品无码| 国内精品久久久久久久亚洲| 少妇久久久久久久久久| 久久精品国产亚洲Aⅴ香蕉 | 国内精品久久人妻互换| 久久久久久国产精品无码下载| 久久精品人人做人人爽电影蜜月 | 国产日产久久高清欧美一区| 欧美黑人激情性久久| 久久久久人妻一区精品| 99热精品久久只有精品| 热re99久久精品国产99热| 久久亚洲欧美国产精品| 亚洲va国产va天堂va久久| 日韩欧美亚洲综合久久影院Ds| 99久久精品国产一区二区| 久久美女网站免费| 国产精品视频久久久| 九九精品99久久久香蕉| 国内精品久久久久影院优| 蜜臀av性久久久久蜜臀aⅴ麻豆| 色播久久人人爽人人爽人人片AV| 久久精品国产亚洲AV不卡| 久久久久18| 久久午夜夜伦鲁鲁片免费无码影视| 色婷婷久久综合中文久久一本| 武侠古典久久婷婷狼人伊人| 久久精品中文字幕有码| 内射无码专区久久亚洲| 亚洲а∨天堂久久精品| 欧美日韩久久中文字幕| 国产亚洲精品美女久久久|