Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <fstream>
- int main() {
- std::ifstream source;
- source.open("sources.txt", std::ios::in);
- std::vector<std::string> data;
- while (source.good()) {
- std::string link;
- source >> link;
- data.push_back(link);
- }
- source.close();
- std::sort(data.begin(), data.end(), [](std::string& a, std::string& b) {return a < b; });
- std::ofstream outfile;
- outfile.open("output.txt");
- for (auto& link : data) {
- outfile << link << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement