青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

T9的空間

You will never walk alone!

  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
  69 隨筆 :: 0 文章 :: 28 評論 :: 0 Trackbacks

#

 1/*
 2  Name: build priority_queue
 3  Copyright: 
 4  Author: Torres
 5  Date: 29-08-08 10:48
 6  Description: 建立優(yōu)先隊列的方法 
 7*/

 8#include<iostream>
 9#include<vector>
10#include<queue>
11using namespace std;
12template<class T>void print(T &a){while(!a.empty()){cout<<a.top()<<" ";a.pop();}cout<<endl;}
13typedef struct node{
14    int x,y;
15    bool operator<(const node &a)const{
16        return x>a.x||(x==a.x&&y>a.y);
17    }

18}
node;
19
20/*typedef struct data{
21    double x,y;
22    bool cmp(data &a){
23        return x>a.x||(x==a.x&&y>a.y);
24    }
25}data;*/

26priority_queue<int,vector<int>,less<int> >LessIntq;//雖然是less但是是最大優(yōu)先
27priority_queue<int>SysIntq;//默認是less
28priority_queue<int,vector<int>,greater<int> >GreatIntq;
29priority_queue<node>Nodeq;
30//priority_queue<data,vector<data>,cmp>Cmpdata;
31
32
33int main()
34{
35    int i,temp;
36    for(i=1;i<=5;i++){
37        scanf("%d",&temp);
38        LessIntq.push(temp);
39        SysIntq.push(temp);
40        GreatIntq.push(temp);
41    }

42    cout<<"LessIntq::";
43    print(LessIntq);
44    cout<<"SysIntq::";
45    print(SysIntq);
46    cout<<"GreatIntq::";
47    print(GreatIntq);
48    cout<<"******************"<<endl;
49
50    node ntemp;
51    for(i=1;i<=5;i++){
52        scanf("%d%d",&ntemp.x,&ntemp.y);
53        Nodeq.push(ntemp);
54    }

55    cout<<"Nodeq::"<<endl;
56    for(i=0;i<5;i++){
57        cout<<Nodeq.top().x<<"::"<<Nodeq.top().y<<endl;
58        Nodeq.pop();
59    }

60
61/*    data dtemp;
62    for(i=1;i<=5;i++){
63        scanf("%lf%lf",&dtemp.x,&dtemp.y);
64        Cmpdata.push(dtemp);
65    }
66    cout<<"Cmpdata::";
67    for(i=0;i<5;i++){
68        cout<<Cmpdata.top().x<<"::"<<Cmpdata.top().y<<endl;
69        Cmpdata.pop();
70    }*/

71    return 0;
72}

73/****************************************
742 5 1 3 7
75LessIntq::7 5 3 2 1
76SysIntq::7 5 3 2 1
77GreatIntq::1 2 3 5 7
78******************
791 2
805 6
812 3
822 10
837 7
84Nodeq::
851::2
862::3
872::10
885::6
897::7
90Press any key to continue
91*************************************/
posted @ 2008-08-29 11:31 Torres 閱讀(352) | 評論 (0)編輯 收藏

     摘要: 在模板參數,傳遞類名,在 ( 離散 ) 函數參數中,使用函數名 ( myStruct(); 或 myFunc ) 內置 <functional> : greater <T>, less<T>, greater_equal<T>, less_equal<T>, equal_to<T>, not_equal_to<T&g...  閱讀全文
posted @ 2008-08-28 21:31 Torres 閱讀(230) | 評論 (0)編輯 收藏

     摘要:   1#include<iostream>  2#include<string>  3#include<algorithm>  4using namespace std;  5int main()  6{ ...  閱讀全文
posted @ 2008-08-19 17:16 Torres 閱讀(288) | 評論 (0)編輯 收藏

C++ Queues

The C++ Queue is a container adapter that gives the programmer a FIFO (first-in, first-out) data structure.

Display all entries for C++ Queues on one page, or view entries individually:

Queue constructor construct a new queue
back returns a reference to last element of a queue
empty true if the queue has no elements
front returns a reference to the first element of a queue
pop removes the first element of a queue
push adds an element to the end of the queue
size returns the number of items in the queue
 1#include<iostream>
 2#include<queue>
 3#include<algorithm>
 4using namespace std;
 5int main()
 6{
 7    //隊列,first_in ,first_out,不提供迭代器,不提供走訪功能
 8    int i;
 9    queue<int>q;
10    for(i=0;i<5;i++)q.push(i);
11    while(q.size()){
12        cout<<q.front();
13        q.pop();
14    }

15    return 0;
16}

17
posted @ 2008-08-18 11:36 Torres 閱讀(12109) | 評論 (0)編輯 收藏

C++ Double-ended Queues

Double-ended queues are like vectors, except that they allow fast insertions and deletions at the beginning (as well as the end) of the container.

Display all entries for C++ Double-ended Queues on one page, or view entries individually:

Container constructors create dequeues and initialize them with some data
Container operators compare, assign, and access elements of a dequeue
assign assign elements to a dequeue
at returns an element at a specific location
back returns a reference to last element of a dequeue
begin returns an iterator to the beginning of the dequeue
clear removes all elements from the dequeue
empty true if the dequeue has no elements
end returns an iterator just past the last element of a dequeue
erase removes elements from a dequeue
front returns a reference to the first element of a dequeue
insert inserts elements into the dequeue
max_size returns the maximum number of elements that the dequeue can hold
pop_back removes the last element of a dequeue
pop_front removes the first element of the dequeue
push_back add an element to the end of the dequeue
push_front add an element to the front of the dequeue
rbegin returns a reverse_iterator to the end of the dequeue
rend returns a reverse_iterator to the beginning of the dequeue
resize change the size of the dequeue
size returns the number of items in the dequeue
swap swap the contents of this dequeue with another

在我看來,deque就是一個雙端的array,和vector是一摸一樣的,雖然內部機制不一樣
 1/*
 2  Name: C++ DEQUE   
 3  Copyright: 
 4  Author: Torres
 5  Date: 18-08-08 10:55
 6  Description: STL DEQUE 學習筆記 
 7*/

 8#include<deque>
 9#include<iostream>
10#include<algorithm>
11using namespace std;
12#define showpass cout<<"pass"<<endl
13typedef struct point{
14    double x,y;
15    point(double a=0,double b=0){
16        x=a;
17        y=b;
18    }

19}
point;
20ostream operator<<(ostream out,point a)
21{
22    return out<<a.x<<" "<<a.y<<endl;
23}

24
25void print(point a)
26{
27    cout<<a;
28}

29int main()
30{
31    //deque與vector很相似只不過是兩端都可以存取的vector
32    deque<point>cp,cp1(10);
33    int i;
34    for(i=0;i<5;i++){
35        point temp(i,i+1);
36        cp.push_back (temp);
37    }

38    
39    for(i=0;i<5;i++){
40        cp1[i].x=i;
41        cp1[i].y=i+1;
42    }

43    //取地址符號[]必須在容器已經開辟空間后才能用,push函數開辟了新空間
44    for_each(cp.begin(),cp.end(),print);
45    cout<<endl;
46    for_each(cp1.begin(),cp1.end()-5,print);
47    cout<<endl;
48    
49    //erase刪除函數
50    cp.erase(cp.begin()+1);
51    for_each(cp.begin(),cp.end(),print);
52    cout<<endl;
53    cp1.erase(cp1.begin(),cp1.begin()+3);
54    for_each(cp1.begin(),cp1.end()-5,print);
55    cout<<endl;
56
57    cout<<cp.front()<<cp.back()<<endl; 
58
59
60    return 0;
61}

posted @ 2008-08-18 11:02 Torres 閱讀(669) | 評論 (0)編輯 收藏

先看函數:
C++ Lists

Lists are sequences of elements stored in a linked list. Compared to vectors, they allow fast insertions and deletions, but slower random access.

Display all entries for C++ Lists on one page, or view entries individually:

List constructors create lists and initialize them with some data
List operators assign and compare lists
assign assign elements to a list
back returns a reference to last element of a list
begin returns an iterator to the beginning of the list
clear removes all elements from the list
empty true if the list has no elements
end returns an iterator just past the last element of a list
erase removes elements from a list
front returns a reference to the first element of a list
insert inserts elements into the list
max_size returns the maximum number of elements that the list can hold
merge merge two lists
pop_back removes the last element of a list
pop_front removes the first element of the list
push_back add an element to the end of the list
push_front add an element to the front of the list
rbegin returns a reverse_iterator to the end of the list
remove removes elements from a list
remove_if removes elements conditionally
rend returns a reverse_iterator to the beginning of the list
resize change the size of the list
reverse reverse the list
size returns the number of items in the list
sort sorts a list into ascending order
splice merge two lists in constant time
swap swap the contents of this list with another
unique removes consecutive duplicate elements

要注意的是list不提隨機的迭代器,迭代器是個雙向的,非連續(xù)存儲,而且是個環(huán)狀鏈表在尾端是個未初始化節(jié)點
空判斷:begin==end;
clear  remove  unique(把相同元素移出,留一個先sort)  insert(插入兩種方式)
只能使用成員函數 sort,不能使用 算法 sort(他只接受random iterator)

 1/*
 2  Name: C++ STL LIST    
 3  Copyright: 
 4  Author: Torres
 5  Date: 17-08-08 23:28
 6  Description: LIST 學習筆記 
 7*/

 8#include<iostream>
 9#include<list>
10#include<vector>
11#include<algorithm>
12using namespace std;
13typedef struct node{
14    double x,y;
15    node (double a=0,double b=0){
16        x=a;
17        y=b;
18    }

19}
node;
20void print(int a){printf("%d ",a);return;}
21
22ostream operator <<(ostream out,node a)
23{
24    return out<<a.x<<" "<<a.y<<endl;
25}

26int main()
27{
28    int i,j;
29
30    list<node>nlist;
31    list<int>intlist,intlist1;
32    
33    vector<int>intv1,intv2;
34    intv1.assign(5,7);
35    intv2.assign(intv1.begin()+1,intv1.end()-1);
36    for_each(intv2.begin()+1,intv2.end(),print);
37    cout<<endl;
38
39    //assign的用法,有兩種,發(fā)現list的iterator不能夠相加而vector可以
40    intlist.assign(5,7);
41    intlist1.assign(intlist.begin(),intlist.end());
42    for_each(intlist.begin(),intlist.end(),print);
43    printf("\n");
44    for_each(intlist1.begin(),intlist1.end(),print);
45    printf("\n");
46    
47    //size的用法,表示實際數據的大小
48    cout<<intlist.size()<<endl;
49    //list沒有容量capacity函數
50
51    //因為list是一個雙端鏈表,不支持隨機存取,他的存取必須用iterator來進行
52    //而vector,deque,等容器是支持的。
53    list<int>::iterator it1;
54    for(it1=intlist1.begin();it1!=intlist1.end();it1++)
55        cout<<*it1<<" ";
56    cout<<endl;
57
58    const node cnode(1.0,2.0);
59    cout<<cnode<<endl;
60
61    nlist.assign(5,cnode);
62    list<node>::iterator it2;
63    for(it2=nlist.begin();it2!=nlist.end();it2++)
64        cout<<*it2;
65    return 0;
66}

67

posted @ 2008-08-17 23:30 Torres 閱讀(679) | 評論 (0)編輯 收藏

菜菜的學習了一下STL的vector,做一下筆記感覺這個網站講得通俗易懂http://www.cppreference.com/cppvector/index.html 寫了一下測試code(待續(xù))

C++ Vectors

Vectors contain contiguous elements stored as an array. Accessing members of a vector or appending elements can be done in constant time, whereas locating a specific value or inserting elements into the vector takes linear time.

Display all entries for C++ Vectors on one page, or view entries individually:

Vector constructors create vectors and initialize them with some data
Vector operators compare, assign, and access elements of a vector
assign assign elements to a vector
at returns an element at a specific location
back returns a reference to last element of a vector
begin returns an iterator to the beginning of the vector
capacity returns the number of elements that the vector can hold
clear removes all elements from the vector
empty true if the vector has no elements
end returns an iterator just past the last element of a vector
erase removes elements from a vector
front returns a reference to the first element of a vector
insert inserts elements into the vector
max_size returns the maximum number of elements that the vector can hold
pop_back removes the last element of a vector
push_back add an element to the end of the vector
rbegin returns a reverse_iterator to the end of the vector
rend returns a reverse_iterator to the beginning of the vector
reserve sets the minimum capacity of the vector
resize change the size of the vector
size returns the number of items in the vector
swap swap the contents of this vector with another

 1#include<vector>
 2#include<iostream>
 3#include<algorithm>
 4using namespace std;
 5void print(int a){cout<<a<<" ";}
 6int main()
 7{
 8    vector<int>v,v1;
 9    vector<int>::iterator iv1,iv2;
10    vector<int>v2;
11    v2.reserve(10);    
12    v.assign(10,2);
13    cout<<v2.capacity()<<endl;//capacity容量輸出為10
14    cout<<v2.size()<<endl;//大小輸出為1
15    int i;
16    for(i=0;i<7;i++)v2.push_back(i);
17    for_each(v2.begin(),v2.end(),print);
18    cout<<endl;
19    for(iv1=v2.begin();iv1!=v2.end();iv1++)
20        if(*iv1==3)break;
21    if(iv1!=v2.end())v2.insert(iv1,99);
22    for_each(v2.begin(),v2.end(),print);
23    cout<<endl;
24    if(iv1!=v2.end())v2.insert(iv1,5,99);
25    for_each(v2.begin(),v2.end(),print);
26    cout<<endl;
27    if(iv1!=v2.end())v2.insert(iv1,v.begin(),v.end());
28    for_each(v2.begin(),v2.end(),print);
29    cout<<endl;
30    cout<<v2.size()<<endl;
31    v2.erase(v2.begin());
32    cout<<v2.size()<<endl;
33    v2.erase(v2.begin(),v2.end());
34    for_each(v2.begin(),v2.end(),print);
35    iv1=v.begin();iv2=v.end();
36    cout<<v.begin()<<endl;
37    cout<<v.end()<<endl;
38    cout<<iv1<<endl;
39    cout<<iv2<<endl;
40//    for(i=0;i<15;i++)cout<<v[i]<<" ";
41//    cout<<endl;
42//    for(i=0;i<15;i++)cout<<v.at(i)<<" ";//at()函數更加安全;
43//    cout<<endl;
44    for_each(v.begin(),v.end(),print);
45    cout<<endl;
46//    v1.assign(v.begin(),v.end());
47//    v1.assign(iv1+2,iv2-2);
48//    for(i=0;i<10;i++)cout<<v1[i]<<' ';
49//    cout<<endl;
50    for(i=0;i<10;i++)v1.push_back(i);
51    for_each(v1.begin()+1,v1.end()-2,print);//輸出begin開始指向的數據,直到end指向的前一個數據
52    for_each(v1.begin(),v1.end(),print);
53    cout<<endl;
54    cout<<v1.back()<<endl;
55    cout<<v1.front()<<endl;
56    cout<<v1.size()<<endl;
57    v.clear();
58    cout<<v.size()<<endl;
59    for_each(v.begin(),v.end(),print);//已經clear,begin==end,不會有任何結果。
60    return 0;
61}

62
63
64
65//試了一下結構體,感覺自己簡直太水了,努力學習中!
66
67#include<iostream>
68#include<vector>
69using namespace std;
70typedef struct node{
71    int x;
72    int y;
73}
node;
74ostream operator<<(ostream in,node a){
75    in<<a.x<<a.y<<endl;
76    return in;
77}

78int main()
79{
80    vector<node>v(10);
81    v[0].x=1;v[0].y=1;
82    vector<node>::iterator iv(v.begin());
83    cout<<v[0].x<<v[0].y<<endl;
84    cout<<*iv<<endl;
85    cout<<iv->x<<iv->y<<endl;
86    return 0;
87}
posted @ 2008-08-13 00:54 Torres 閱讀(178) | 評論 (0)編輯 收藏

一直想有一個blog,做做筆記,整理整理思路,基于這個思想,這個blog誕生了!以后就靠這個來祭奠生活了。
posted @ 2008-08-11 12:30 Torres 閱讀(191) | 評論 (1)編輯 收藏

僅列出標題
共7頁: 1 2 3 4 5 6 7 
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美在线在线| 91久久国产自产拍夜夜嗨| 91久久综合亚洲鲁鲁五月天| 国产精品久久久久久久久动漫 | 91久久在线观看| 国产精品一区二区久久久久| 欧美国产日本韩| 久久久久成人精品免费播放动漫| 亚洲视频欧美在线| 亚洲黄色在线看| 蜜桃伊人久久| 久久久777| 午夜精品99久久免费| 9国产精品视频| 亚洲高清自拍| 一区久久精品| 韩国久久久久| 国产综合色产| 国产精品人人做人人爽 | 国产日韩一区二区三区在线| 欧美日韩1区2区| 牛牛影视久久网| 久久久久久9| 亚洲欧美日本在线| 亚洲自拍偷拍福利| 一区二区三区欧美视频| 亚洲黄色片网站| 欧美福利一区| 欧美成人中文字幕| 女同一区二区| 蜜臀av性久久久久蜜臀aⅴ| 久久免费精品日本久久中文字幕| 欧美一区在线看| 久久成人久久爱| 欧美在线网站| 久久精品视频免费| 久久精品国产v日韩v亚洲| 欧美一区二区三区在线看| 午夜一区二区三区不卡视频| 亚洲欧美日韩精品久久亚洲区| 亚洲午夜在线视频| 亚洲伊人网站| 香蕉乱码成人久久天堂爱免费| 性久久久久久久久久久久| 香蕉久久一区二区不卡无毒影院 | 91久久国产综合久久91精品网站| 欧美激情视频一区二区三区不卡| 看片网站欧美日韩| 欧美1区免费| 亚洲激情成人网| 亚洲精选国产| 亚洲一二三四久久| 欧美一区二区精美| 久久久噜噜噜久久人人看| 米奇777超碰欧美日韩亚洲| 欧美国产日韩一区二区在线观看 | 一区久久精品| 亚洲人成在线播放| 亚洲视频精品| 午夜精品久久久久久| 久久网站热最新地址| 欧美成人激情视频| 亚洲精品一区二区三区樱花| 中文欧美日韩| 久久疯狂做爰流白浆xx| 欧美成人激情视频| 国产精品成人一区二区三区吃奶| 国产精品一页| 亚洲电影网站| 亚洲一级黄色| 久久综合影音| 亚洲精品久久久久久一区二区| 亚洲视频中文| 久久亚洲私人国产精品va媚药| 欧美精品一卡| 国产一区二区三区成人欧美日韩在线观看 | 久久精品女人的天堂av| 欧美大片免费观看在线观看网站推荐| 欧美日韩中文| 在线成人黄色| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 欧美丰满高潮xxxx喷水动漫| 国产精品视频福利| 亚洲大片一区二区三区| 亚洲一区二区三区高清| 麻豆国产精品一区二区三区| 99精品视频免费| 久久天堂精品| 国产精品久久综合| 亚洲三级电影全部在线观看高清| 亚洲欧美日本国产专区一区| 欧美a级一区| 午夜精品久久久久| 欧美极品在线播放| 激情综合色丁香一区二区| 亚洲综合视频网| 亚洲国产精品电影在线观看| 欧美亚洲网站| 欧美性猛片xxxx免费看久爱| 亚洲黄色在线| 久久久欧美一区二区| 日韩午夜在线视频| 欧美a级片网| 黑人操亚洲美女惩罚| 亚洲尤物影院| 亚洲区国产区| 噜噜噜躁狠狠躁狠狠精品视频| 国产女主播视频一区二区| 日韩视频免费观看高清完整版| 久久久久网站| 亚洲欧美制服中文字幕| 欧美婷婷久久| 日韩亚洲一区二区| 欧美电影免费观看网站| 久久久www免费人成黑人精品 | 久久精品亚洲乱码伦伦中文 | 久久久精品日韩| 国产伦精品一区二区三区免费| 一本久久知道综合久久| 欧美成人日韩| 久久亚洲色图| 在线电影国产精品| 久久一区二区精品| 久久成人一区| 国产在线一区二区三区四区| 欧美在线观看视频一区二区| 亚洲一区三区视频在线观看| 国产精品久久国产精品99gif| 亚洲视频1区2区| 99国内精品久久久久久久软件| 欧美精品v日韩精品v国产精品| 亚洲日本成人| 亚洲国产三级在线| 欧美黄色小视频| 亚洲精选成人| 91久久精品视频| 欧美激情国产高清| 一本色道**综合亚洲精品蜜桃冫| 亚洲欧洲日韩综合二区| 欧美精品免费观看二区| 亚洲六月丁香色婷婷综合久久| 亚洲国产婷婷| 欧美理论电影在线播放| 在线一区二区三区做爰视频网站| 日韩一级在线观看| 欧美午夜视频网站| 午夜在线一区| 欧美一区二区高清在线观看| 影院欧美亚洲| 欧美激情片在线观看| 欧美乱人伦中文字幕在线| 亚洲一区二区三区精品视频| 亚洲欧美不卡| 狠狠网亚洲精品| 欧美激情一区二区三区在线视频| 欧美96在线丨欧| 中文亚洲视频在线| 亚洲免费视频一区二区| 韩国久久久久| 亚洲国产91精品在线观看| 欧美久久久久免费| 香蕉视频成人在线观看| 久久精品中文字幕一区| 亚洲精品一二| 亚洲午夜在线视频| 黄色成人精品网站| 91久久久久久久久| 国产精品视频不卡| 欧美+亚洲+精品+三区| 欧美日韩国产综合久久| 久久国产精品黑丝| 美国成人直播| 亚洲自拍偷拍麻豆| 久久久精彩视频| 亚洲午夜精品久久久久久app| 久久se精品一区精品二区| 最新中文字幕一区二区三区| 亚洲午夜成aⅴ人片| 在线观看亚洲专区| 在线视频亚洲| 亚洲高清在线观看| 亚洲一区二区三区777| 亚洲国产日本| 亚洲欧美一区二区激情| 亚洲精品国产精品乱码不99按摩 | 亚洲性视频网址| 久久av红桃一区二区小说| 一区二区欧美精品| 久久久水蜜桃| 欧美亚洲视频| 欧美另类高清视频在线| 久久综合给合| 国产精品免费在线| 亚洲黄色影片| 亚洲成人在线视频播放| 亚洲一区二区欧美日韩| av成人黄色| 麻豆国产精品va在线观看不卡| 性久久久久久久| 欧美午夜精品久久久|