1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include <algorithm>
- #include <fstream>
- #include <iostream>
- #include <vector>
- #include "util/string_util.hpp"
- int main(int argc, char** argv)
- {
- std::vector<std::string> lines;
-
-
- std::string line;
- if (argc > 1)
- {
- for(int i = 1; i < argc; ++i)
- {
- std::ifstream in(argv[i]);
- while(std::getline(in, line))
- {
- lines.push_back(line);
- }
- }
- }
- else
- {
- while(std::getline(std::cin, line))
- {
- lines.push_back(line);
- }
- }
-
-
- std::sort(lines.begin(), lines.end(), StringUtil::numeric_less);
-
- for(std::vector<std::string>::iterator i = lines.begin(); i != lines.end(); ++i)
- {
- std::cout << *i << std::endl;
- }
- return 0;
- }
|