set greator

#include <iostream>
#include
<string.h>
#include
<stdlib.h>
#include
<algorithm>
#include
<set>
#include
<stdio.h>
#include
<functional>

using namespace std;

int main( )
{
set<string,greater<string> >T;
int i;
char str[10];
//字符串插入
for(i = 0; i < 4; i++) {
scanf(
"%s",str);
T.insert(str);
}
//判断插入是否成功,已存在则返回0,插入成功将返回1
if (T.insert("tangcong").second)
cout
<<"set insert success"<<endl;
else
cout
<<"set insert fail!"<<endl;
for(set<string,greater<int> >::iterator p = T.begin( ); p != T.end( ); p++)
cout
<<*p<<endl;
return 0;
}

posted on 2011-07-29 09:40  more think, more gains  阅读(193)  评论(0编辑  收藏  举报

导航