zoukankan      html  css  js  c++  java
  • c++ 指定长度容器元素的拷贝(copy_n)

    #include <iostream>     // cout

    #include <algorithm>    // copy

    #include <vector>       // vector

    using namespace std;

    int main () {

        int myints[]={10,20,30,40,50,60,70};

        vector<int> myvector;

        

        myvector.resize(2);   // allocate space for 7 elements

        

        copy_n ( myints, 5, myvector.begin() );

        

        cout << "myvector contains:";

        for (vector<int>::iterator it = myvector.begin(); it!=myvector.end(); ++it)

            cout << ' ' << *it;

        

        cout << ' ';

        

        return 0;

    }

  • 相关阅读:
    合代码、merge代码
    springboot 获取项目版本
    软考复习思路之疫情来的太突然之备战明年软考中级之软件设计师
    供应链管理笔记 概述2
    供应链管理笔记
    供应链管理 流程与实施1
    Winform中内嵌显示Office
    数据库提交数据注意事项
    工业互联网
    C#利用using System.Net实现Json数据提交WebAPI
  • 原文地址:https://www.cnblogs.com/sea-stream/p/9816167.html
Copyright © 2011-2022 走看看