• <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 返回的結果 >= 參數 value
            upper_bound 返回的結果 > 參數 value

            具體明細可參見百科
            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 閱讀(634) 評論(0)  編輯 收藏 引用
            久久九九亚洲精品| 国产精品欧美亚洲韩国日本久久| 久久亚洲国产精品123区| 亚洲国产日韩欧美久久| 久久99国产综合精品女同| 国产精品美女久久久久AV福利| 伊人色综合久久天天人守人婷| 精品国际久久久久999波多野| 久久久久国产成人精品亚洲午夜| 久久午夜夜伦鲁鲁片免费无码影视| 97久久超碰国产精品2021| 一本色综合久久| 久久精品国产99国产电影网 | 久久99久国产麻精品66| 国产成人久久精品麻豆一区| 影音先锋女人AV鲁色资源网久久| 国产免费福利体检区久久| 久久精品视频网| 久久久久久久人妻无码中文字幕爆| 日批日出水久久亚洲精品tv| 狠狠色丁香婷婷综合久久来| 狠狠综合久久AV一区二区三区| 四虎影视久久久免费观看| 国内精品久久久久久久涩爱| 一本大道久久a久久精品综合| 久久亚洲AV成人无码国产| 一本色道久久HEZYO无码| 久久久久亚洲av成人网人人软件 | 精品多毛少妇人妻AV免费久久| 久久93精品国产91久久综合| 久久99热这里只有精品国产| 久久久久99精品成人片三人毛片| 成人国内精品久久久久影院VR| 岛国搬运www久久| 亚洲综合婷婷久久| 久久精品无码一区二区三区免费 | 久久国产成人午夜AV影院| 久久精品国产欧美日韩| 久久亚洲国产精品123区| 国产伊人久久| 一本色综合久久|