木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺

upper_bound()与lower_bound()使用方法

#include <iostream>
#include <algorithm>//必须包含的头文件
using namespace std;
int main(){
 int point[10] = {1,3,7,7,9};
 int tmp = upper_bound(point, point + 5, 7) - point;//按从小到大,7最多能插入数组point的哪个位置
 printf("%dn",tmp);
 tmp = lower_bound(point, point + 5, 7) - point;////按从小到大,7最少能插入数组point的哪个位置
 printf("%dn",tmp);
 return 0;
}
output:
4
2


posted @ 2013-06-06 13:13  C语言程序  阅读(439)  评论(0编辑  收藏  举报
木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺