| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1167 人关注过本帖
标题:[分享]partition() 实在无聊之举~
取消只看楼主 加入收藏
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
 问题点数:0 回复次数:1 
[分享]partition() 实在无聊之举~

#include <vector> #include <algorithm> #include <iostream>

bool greater5 ( int value ) { return value >5; }

int main( ) { using namespace std; vector <int> v1, v2; vector <int>::iterator Iter1; int i; for ( i = 0 ; i <= 10 ; i++ ) { v1.push_back( i ); } random_shuffle( v1.begin( ), v1.end( ) ); cout << "Vector v1 is ( " ; for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ ) cout << *Iter1 << " "; cout << ")." << endl; // Partition the range with predicate greater5 partition ( v1.begin( ), v1.end( ), greater5 ); cout << "The partitioned set of elements in v1 is: ( " ; for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ ) cout << *Iter1 << " "; cout << ")." << endl; return 0; }

//小菜给大家(主要给刚入门的)看看,不运行,能说说运行结果(大致)

[此贴子已经被作者于2004-11-12 22:21:47编辑过]

搜索更多相关主题的帖子: partition 分享 
2004-11-12 22:20
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
得分:0 

呵呵~看过也算达到目的了


2004-11-12 22:55
快速回复:[分享]partition() 实在无聊之举~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011642 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved