1 //uppper_bound上确界找出首个大于某值的元素 2 #include<algorithm> 3 #include<iostream> 4 5 using namespace std; 6 7 int main() 8 { 9 int a[] = {23, 9, 7, 2, 3, 4}; 10 int len = sizeof(a)/int (a); 11 int *x = upper_bound(a, a+len, 7); 12 13 cout<<"不小于7的上确界元素为"<<*x<<endl; 14 15 system("pause"); 16 17 return 0; 18 }