#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int num[10]={-5,1,4,6,8,15,15,25,65,99};
for(int i=0;i<10;i++)
printf("%d ",num[i]);
printf("\n");
int ind1=lower_bound(num,num+10,15)-num; //返回第一个大于等于15的下标
int ind2=upper_bound(num,num+10,15)-num; //返回第一个大于15的下标
printf("lower_bound: %d \n",ind1);
printf("upper_bound: %d \n",ind2);
return 0;
}
-5 1 4 6 8 15 15 25 65 99
lower_bound: 5
upper_bound: 7