首页 > 编程语言 > 详细

essential c++ source code part 1

时间:2018-06-07 10:11:25      阅读:232      评论:0      收藏:0      [点我收藏+]

 

#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main()
{
    ifstream in_file("a.txt");
    ofstream out_file("b.txt");

    if (!in_file || !out_file) {
        cout << "unable to open file" << endl;
        return -1;
    }

    istream_iterator<string> is(in_file);
    istream_iterator<string> eof;

    vector<string> text;
    copy(is, eof, back_inserter(text));

    sort(text.begin(), text.end());

    ostream_iterator<string> os(out_file, " ");
    copy(text.begin(), text.end(), os);
}

 

essential c++ source code part 1

原文:https://www.cnblogs.com/pfsi/p/9149076.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!