user24636
0
Q:

get values from a vector of vectors c++

#include <iostream>
#include <vector>
using namespace std;  

int main()
{
    vector<vector<int> > buff;

    for(int i = 0; i < 10; i++)
    {
        vector<int> temp; // create an array, don't work directly on buff yet.
        for(int j = 0; j < 10; j++)
            temp.push_back(i); 
 
        buff.push_back(temp); // Store the array in the buffer
    }

    for(int i = 0; i < buff.size(); ++i)
    {
        for(int j = 0; j < buff[i].size(); ++j)
            cout << buff[i][j];
        cout << endl;
    }

    return 0;
}
2
// Initializing vector with values 
    vector<int> vect1{1, 2, 3, 4}; 
  
    // Declaring another vector 
    vector<int> vect2; 
  
    // Copying vector by assign function 
    vect2.assign(vect1.begin(), vect1.end()); 
0

New to Communities?

Join the community