| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 367 人关注过本帖
标题:错在哪呢 ?
只看楼主 加入收藏
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
快速回复:错在哪呢 ?
数据加载中...
 
   



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

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