Files
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

19 lines
456 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}