首页 > 其他 > 详细

相邻两个数

时间:2019-02-02 00:58:23      阅读:192      评论:0      收藏:0      [点我收藏+]
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int main()
{
    vector<unsigned> scores;
    for (decltype(scores.size()) ix = 0; ix < 11; ++ix) {
        scores.push_back(ix);
    }
    //sort(scores.begin(), scores.end());
    //for (vector<unsigned>::iterator it = scores.begin(); *it < scores.size(); it++) {
    //    cout<<it
    //}
    for (decltype(scores.size()) ix = 0; ix < scores.size()-1;ix+=2 ) {
        cout << scores[ix] + scores[ix + 1] <<  ;
    }
    if (scores.size() % 2 != 0) {
        cout << "最后一个" << endl;
    }


    system("pause");
}

 

相邻两个数

原文:https://www.cnblogs.com/jingchu/p/10347394.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!