- //文件名:CHAPTER4-11.cpp
- #include <string>
- #include <iostream>
- #include <set>
- #include <algorithm>
- using namespace std;
- void listWords(istream& in, ostream& out)
- { string s;
- set<string> mySet;
- unsigned int size=0;
- while (size<2){in >> s; mySet.insert(s); size++;}
- for (set<string>::iterator b = mySet.begin(); b != mySet.end(); b++) {out << *b << endl;}
- }
- void main() { listWords(cin, cout);}