how to declare 2d vector in c++ code example
Example 1: 2d vector c++ declaration
vector< vector> a(rows, vector (cols));
Example 2: initialising 2d vector
// Initializing 2D vector "vect" with
// values
vector > vect{ { 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 } };
Example 3: how to take input in 2d vector in c++
std::vector> d;
//std::vector d;
cout<<"Enter the N number of ship and port:"<>in;
cout<<"\Enter preference etc..:\n";
for(i=0; i>temp;
d[i].push_back(temp);
}
}