Advertisement
Guest User

Untitled

a guest
May 9th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <string>
  3. #include <iostream>
  4. #include <fstream>
  5. #include <list>
  6. #include <algorithm>
  7. #include <iterator>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13.  
  14. ifstream in("input.txt");
  15. ofstream out("output.txt");
  16. list<string> lines;
  17.  
  18. while (!in.eof())
  19. {
  20. string s1;
  21. getline(in, s1, '\n');
  22. lines.push_back(s1);
  23. }
  24. lines.sort();
  25. copy(lines.begin(), lines.end(), ostream_iterator<string>(out, "\n"));
  26. in.close();
  27. out.close();
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement