#include <cmath>
double ceil (double);
double floor (double);
注意返回值类型为double,需要强制类型转换为整型
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
set<int> a;
int arr[10];
int b;
for (int i = 0; i < 10; i++)
{
a.insert(i);
arr[i] = i;
}
cout << *a.upper_bound(1) << endl;
cout << *a.lower_bound(1) << endl;
cout << upper_bound(arr, arr + 10, 1) - arr << endl;
cout << lower_bound(arr, arr + 10, 15) - arr << endl;
cout << (a.upper_bound(11) == a.end()) << endl;
cout << binary_search(arr, arr + 10, 1) << endl;
cout << binary_search(arr, arr + 10, 15) << endl;
return 0;
}