You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
438 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<bits/stdc++.h>
using namespace std;
int main() {
set<int> s;
set<int>::iterator iter;
for(int i = 1 ; i <= 5; ++i) {
s.insert(i);
}
for(iter = s.begin() ; iter != s.end() ; ++iter) {
cout<<*iter<<" ";
}
cout<<endl;
pair<set<int>::const_iterator,set<int>::const_iterator> pr;
pr = s.equal_range(3);
cout<<"第一个大于等于 3 的数是 "<<*pr.first<<endl;
cout<<"第一个大于 3的数是 "<<*pr.second<<endl;
return 0;
}