|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <iostream>
#include <set>
#include <string>
int main()
{
using namespace std;
const int N = 6;
string s1[N] = { "buffoon", "thinkers", "for", "heavy", "can", "for" };
set<string> A(s1, s1 + N);
ostream_iterator<string, char> out(cout, " ");
copy(A.begin(), A.end(), out);//buffoon can for heavy thinkers
return 0;
}
ostream_iterator<string, char> out(cout, " ");//这句话的string,char分别有什么用吗,我把char去掉好像也可以打印
因为你要输出的是string,所以要写string;
- template <class Type, class CharType = char, class Traits = char_traits <CharType>>
- class ostream_iterator;
复制代码
因为默认就是char,所以去掉也行。
|
|