阅读程序

来源:互联网 发布:欠淘宝消保 编辑:程序博客网 时间:2024/06/10 09:05

  1. /* 
  2. *Copyright (c) 2016,烟台大学计算机学院 
  3. *All rights reserved. 
  4. *文件名称:zwj.cpp 
  5. *作    者:李落才
  6. *完成日期:2016年6月5日 
  7. *版 本 号:v1.0 
  8. * 
  9. *问题描述:阅读程序,对照运行结果,领会STL的用法 
  10. *输入描述: 
  11. *程序输出: 
  12. */  
  13. #include <string>  
  14. #include <set>  
  15. #include <iterator>  
  16. #include <iostream>  
  17. using namespace std;  
  18. int main()  
  19. {  
  20.     set <string> strset;  
  21.     strset.insert("cantaloupes");  
  22.     strset.insert("grapes");  
  23.     strset.insert("apple");  
  24.     strset.insert("orange");  
  25.     strset.insert("banana");  
  26.     strset.insert("grapes");  
  27.     copy(strset.begin(), strset.end(), ostream_iterator<string>(cout, " "));  
  28.     cout << endl;  
  29.     return 0;  
  30. }  
0 0