Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <set>
- using namespace std;
- typedef set<string> ss_t;
- ss_t ipSet;
- void process(char* iname, char* oname)
- {
- // NlogN
- ifstream fin(iname);
- string ip;
- while (fin >> ip) ipSet.insert(ip);
- fin.close();
- ofstream fout(oname);
- for (ss_t::iterator it = ipSet.begin(); it != ipSet.end(); ++it) fout << *it << '\n';
- fout.close();
- }
- int main(int argc, char* argv[])
- {
- if (argc != 3) {
- cout << "Usage: " << argv[0] << " infile outfile" << endl;
- } else {
- process(argv[1], argv[2]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement