13,824
社区成员
发帖
与我相关
我的任务
分享
while(getline(input,line))
{
istringstream stream(line);
string word;
bool firstword=true;
while(stream>>word)
{
map<string,string>::const_iterator map_it=trans_map.find(word);
if(map_it!=trans_map.end())
word=map_it->second; //运行成功
if(firstword)
firstword=false;
else cout<<" ";
// word=map_it->second; //运行产生错误
cout<<word;
}
cout<<endl;
}