• <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>
            posts - 183,  comments - 10,  trackbacks - 0
            STL algorithm 中的 lower_bound and upper_bound

            lower_bound 返回的結(jié)果 >= 參數(shù) value
            upper_bound 返回的結(jié)果 > 參數(shù) value

            具體明細(xì)可參見百科
            lower_bound:http://baike.baidu.cn/view/4720650.htm
            upper_bound:http://baike.baidu.cn/view/4163451.htm

            測(cè)試代碼:
             1 #include <iostream>
             2 #include <set>
             3 #include <algorithm>
             4 using namespace std;
             5 
             6 int main()
             7 {
             8     set<int> si;
             9     //cout << si.insert(3) << endl;
            10     cout << *(si.insert(3).first) << endl;
            11     
            12     for (int i = 1; i <= 10; i += 2)
            13     {
            14         si.insert(i);
            15     }
            16     for (set<int>::const_iterator cit = si.begin(); cit != si.end(); ++cit)
            17     {
            18         cout << *cit << ' ';
            19     }
            20     cout << endl;
            21     
            22     cout << endl;
            23     cout << *lower_bound(si.begin(), si.end(), 3<< endl;
            24     cout << *lower_bound(si.begin(), si.end(), 4<< endl;
            25     cout << *lower_bound(si.begin(), si.end(), 5<< endl;
            26     cout << *lower_bound(si.begin(), si.end(), 6<< endl;
            27     
            28     cout << endl;
            29     cout << *upper_bound(si.begin(), si.end(), 3<< endl;
            30     cout << *upper_bound(si.begin(), si.end(), 4<< endl;
            31     cout << *upper_bound(si.begin(), si.end(), 5<< endl;
            32     cout << *upper_bound(si.begin(), si.end(), 6<< endl;
            33     
            34     system("PAUSE");
            35 }
            36 

            輸出:

            3
            1 3 5 7 9

            3
            5
            5
            7

            5
            5
            7
            7


            posted on 2013-05-30 20:55 unixfy 閱讀(628) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            日韩中文久久| 久久96国产精品久久久| 久久嫩草影院免费看夜色| 久久99国产精品久久99小说| 亚洲色欲久久久综合网| 国产精品九九九久久九九| 国产香蕉97碰碰久久人人| 狠狠综合久久AV一区二区三区| 精品人妻久久久久久888| 色婷婷久久综合中文久久一本| 天天躁日日躁狠狠久久| 日韩电影久久久被窝网| 精品综合久久久久久97超人| 久久人人爽人人人人爽AV | 久久精品中文字幕一区| 久久99精品久久久久久水蜜桃| 奇米综合四色77777久久| 思思久久99热只有频精品66| 久久久精品免费国产四虎| 久久久这里只有精品加勒比| 精品久久久久久久中文字幕 | 偷窥少妇久久久久久久久| 久久久中文字幕| 97超级碰碰碰久久久久| 色婷婷综合久久久久中文| 狠狠色丁香久久婷婷综合图片| 国产精品热久久无码av| 曰曰摸天天摸人人看久久久| 国产麻豆精品久久一二三| 久久久久人妻精品一区| 久久AV无码精品人妻糸列| 亚洲国产欧美国产综合久久| 伊人久久大香线蕉成人| 亚洲乱码日产精品a级毛片久久| 国产午夜精品久久久久九九电影 | 天天影视色香欲综合久久| 99久久精品无码一区二区毛片 | 久久99精品国产麻豆宅宅| 日韩欧美亚洲国产精品字幕久久久| 99久久99久久精品国产片| 国产精品综合久久第一页|