书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

2012年3月21日

lower_bound的用法

摘要: lower_bound的headfile是algorithm.lower_bound的工作原理就是二分查找了。lower_bound的作用:lower_bound的返回值减去数组的地址就是要查找的元素在数组中的位置。即:Pos = lower_bound(a, a+10, 3)-a;那么Pos就是在数组a[10]中的位置了。下面给出它的具体用法并说明一些要注意的问题。View Code #include "iostream"#include "algorithm"using namespace std;int main(){ int a[4]={1, 2 阅读全文

posted @ 2012-03-21 22:13 More study needed. 阅读(887) 评论(0) 推荐(0) 编辑

导航

书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!