• <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

            測試代碼:
             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 閱讀(627) 評論(0)  編輯 收藏 引用

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


            亚洲成av人片不卡无码久久| 欧美黑人激情性久久| 国产日韩久久久精品影院首页| 国产精品免费久久| 久久久SS麻豆欧美国产日韩| 久久精品aⅴ无码中文字字幕重口| 伊人丁香狠狠色综合久久| 亚洲国产一成久久精品国产成人综合 | 久久久久国产精品嫩草影院| 国产V综合V亚洲欧美久久| 精品久久久久久久中文字幕| 人妻精品久久无码专区精东影业| AA级片免费看视频久久| 亚洲中文字幕无码久久2020| 国产69精品久久久久99| 欧洲成人午夜精品无码区久久 | 亚洲AⅤ优女AV综合久久久| 国产精品美女久久久久网| 91麻豆国产精品91久久久| 99国内精品久久久久久久| 久久亚洲欧美国产精品 | 精品国产婷婷久久久| 久久亚洲春色中文字幕久久久| 亚洲欧美国产精品专区久久| 国产成人无码精品久久久免费| 久久国产亚洲高清观看| 中文字幕乱码人妻无码久久| 亚洲精品午夜国产va久久| 精品国产91久久久久久久a| 91麻豆精品国产91久久久久久| 高清免费久久午夜精品| 久久久久亚洲AV无码麻豆| 久久精品国产亚洲av麻豆小说 | 亚洲国产成人久久精品99| 理论片午午伦夜理片久久| 精品无码人妻久久久久久| 国产呻吟久久久久久久92| 国产成人久久精品麻豆一区| 很黄很污的网站久久mimi色| 久久久久亚洲av成人无码电影| 精品久久久久久国产三级|