Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ 2d vector assign value

vector<vector<int>> v;
   int val;
   int n = size(v);
   for(int i = 0; i < n; i++)
{
      vector<int> temp;
      for(int j = 0; j < n; j++){
         cin >> val;
      temp.push_back(val);
      }
      v.push_back(temp);
      temp.clear();
 
PREVIOUS NEXT
Tagged: #vector #assign
ADD COMMENT
Topic
Name
5+2 =