Initializing a vector of vectors having a fixed size with boost assign

前端 未结 4 452
Happy的楠姐
Happy的楠姐 2020-12-04 10:10

Having a vector of vector with a fixed size,

vector > v(10);

I would like to initialize it so that it has in all e

4条回答
  •  离开以前
    2020-12-04 10:31

    #include 
    #include 
    using namespace std;
    
    
    int main(){
        int n; cin >> n;
        vector> v(n);
        //populate
        for(int i=0; i> number;
                v[i].push_back(number);
            }
        }
        // display
        for(int i=0; i

    Input:

    4
    11 12 13 14
    21 22 23 24
    31 32 33 34
    41 42 43 44
    

    Output:

    11 12 13 14
    21 22 23 24
    31 32 33 34
    41 42 43 44
    

提交回复
热议问题