Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <string>
- #include <iostream>
- #include <fstream>
- #include <list>
- #include <algorithm>
- #include <iterator>
- using namespace std;
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- list<string> lines;
- while (!in.eof())
- {
- string s1;
- getline(in, s1, '\n');
- lines.push_back(s1);
- }
- lines.sort();
- copy(lines.begin(), lines.end(), ostream_iterator<string>(out, "\n"));
- in.close();
- out.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement