1 #include <iostream> 
 2 #include <set> 
 3 #include <fstream> 
 4 #include <string> 
 5 using namespace std; 
 6 
 7 int main() 
 8 { 
 9     set <string> s; 
10     string str; 
11     ifstream in("source.txt");     
12     ofstream out("result.txt"); 
13 
14     while(getline(fin,str))   //按行读取
15     { 
16         s.insert(str); 
17     } 
18 
19     for(set<string>::iterator it=s.begin(); it!=s.end(); ++it) 
20         out < <*it < <"\n";   //按行输出
21 
22     in.close(); 
23     out.close(); 
24 
25     return 0;
26 } 

相关文章:

  • 2022-01-18
  • 2022-12-23
  • 2021-07-30
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-16
  • 2021-06-28
  • 2021-10-25
  • 2022-02-16
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案