码迷,mamicode.com
首页 > 编程语言 > 详细

essential c++ source code part 1

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

标签:TE   color   begin   vector   AC   int   c++   ||   back   

 

#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

标签:TE   color   begin   vector   AC   int   c++   ||   back   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!