上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 99 下一页

2011年7月29日

greater

摘要: // greater example#include <iostream>#include <functional>#include <algorithm>using namespace std;int main () { int numbers[]={20,40,50,10,30}; sort (numbers, numbers+5, greater<int>() ); for (int i=0; i<5; i++) cout << numbers[i] << " "; cout << 阅读全文

posted @ 2011-07-29 23:31 more think, more gains 阅读(168) 评论(0) 推荐(0) 编辑

distance

摘要: // distance example#include <iostream>#include <iterator>#include <list>using namespace std;int main () { list<int> mylist; for (int i=0; i<10; i++) mylist.push_back (i*10); list<int>::iterator first = mylist.begin(); list<int>::iterator last = mylist.end(); co 阅读全文

posted @ 2011-07-29 23:29 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

advance http://www.cplusplus.com/reference/std/iterator/advance/

摘要: advance example#include <iostream>#include <iterator>#include <list>using namespace std;int main () { list<int> mylist; for (int i=0; i<10; i++) mylist.push_back (i*10); list<int>::iterator it = mylist.begin(); advance (it,5); cout << "The sixth element in 阅读全文

posted @ 2011-07-29 23:28 more think, more gains 阅读(649) 评论(0) 推荐(0) 编辑

priority_queue

摘要: // priority_queue::push/pop#include <iostream>#include <queue>using namespace std;int main (){ priority_queue<int> mypq; mypq.push(30); mypq.push(100); mypq.push(25); mypq.push(40); cout << "Popping out elements..."; while (!mypq.empty()) { cout << " &quo 阅读全文

posted @ 2011-07-29 23:21 more think, more gains 阅读(297) 评论(0) 推荐(0) 编辑

remove

摘要: // remove algorithm example#include <iostream>#include <algorithm>using namespace std;int main () { int myints[] = {10,20,30,30,20,10,10,20}; // 10 20 30 30 20 10 10 20 // bounds of range: int* pbegin = myints; // ^ int* pend = myints+sizeof(myints)/sizeof(int); // ^ ^ pend = remove (pbe 阅读全文

posted @ 2011-07-29 23:18 more think, more gains 阅读(134) 评论(0) 推荐(0) 编辑

上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 99 下一页

导航