- /*
- *Copyright (c) 2016,烟台大学计算机学院
- *All rights reserved.
- *文件名称:zwj.cpp
- *作 者:李落才
- *完成日期:2016年6月5日
- *版 本 号:v1.0
- *
- *问题描述:阅读程序,对照运行结果,领会STL的用法
- *输入描述:
- *程序输出:
- */
- #include <string>
- #include <set>
- #include <iterator>
- #include <iostream>
- using namespace std;
- int main()
- {
- set <string> strset;
- strset.insert("cantaloupes");
- strset.insert("grapes");
- strset.insert("apple");
- strset.insert("orange");
- strset.insert("banana");
- strset.insert("grapes");
- copy(strset.begin(), strset.end(), ostream_iterator<string>(cout, " "));
- cout << endl;
- return 0;
- }