标题:错在哪呢 ?
取消只看楼主
tantan821
Rank: 2
等 级:论坛游民
帖 子:21
专家分:19
注 册:2010-5-15
 问题点数:0 回复次数:0 
错在哪呢 ?
#include <iostream.h>
#include <map>
#include <string>

int main(int argc,char **argv)
{
    map<string,string> trans_map;
    string key,value;
    if (argc!=3)
        throw runtime_error("wrong number of arguments");
    ifstream map_file;
    if(!open_file(map_file,argb[1]))
        throw runtime_error("no transformation file");
    while (map_file>>key>>value)
        trans_map.insert(make_pair(key.value));
    ifstream input;
    if(!open_file(input,avgv[2]))
        throw runtime_error("no input file");
    string line;
    while (getline(input,line)){
        istringstream stream(line);
        string word;
        bool firstword=true;
        while (stream>>word){
            map<string,string>::const_iterator map_i=
                                 trans_map.find(word);
            if(map_it!=trans_map.end())
                word=map_it->second;
            if (firstword)
                firstword=false;
            else
                cout<<" ";
            cout<<word;
        }
        cout<<endl;
    }
    return 0;
}
搜索更多相关主题的帖子: include number wrong file 
2010-08-02 17:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-314619-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024661 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved