高手指点一二

lewis_c402 lewis_c402 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我照着c++ primer中打的原代码, 怎么运行退不出啊! why (原代码如下);

#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <iterator>


using namespace std;

int main()
{
istream_iterator<string> in( cin ), eos;
vector<string> text;

copy( in, eos, back_inserter( text ) );
sort( text.begin(), text.end() );

vector<string>::iterator it;
it = unique( text.begin(), text.end() );
text.erase( it, text.end() );

int line_cnt = 1;
for(vector<string>::iterator iter = text.begin(); iter!=text.end(); ++iter, ++line_cnt )
cout << *iter << ( line_cnt % 9 ? " " : "\n" );
cout << endl;

}
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
lewis_c402
C++ 语言 65,212 成员 250,513 内容