include
include <string.h>
include <stdlib.h>
include
include
include <stdio.h>
using namespace std;
struct compare
{
bool operator ( ) (string s1, string s2)
{
return s1 > s2;
}
};
int main( )
{
set<string,compare>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,compare>::iterator p = T.begin( ); p != T.end( ); p++)
cout<<*p<<endl;
return 0;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询