copy 2 dimensional array c++
//COPY 2D ARRAY TO ANOTHER 2D ARRAY
for (int x=0 ; x < 50; x++)
{
for (int y=0 ; y < 50; y++)
{
b[x][y] = a[x][y];
}
}
copy 2 dimensional array c++
//COPY 2D ARRAY TO ANOTHER 2D ARRAY
for (int x=0 ; x < 50; x++)
{
for (int y=0 ; y < 50; y++)
{
b[x][y] = a[x][y];
}
}
create a 2d vector in c++
// CPP program
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n = 3;
int m = 4;
/*
We create a 2D vector containing "n"
elements each having the value "vector<int> (m, 0)".
"vector<int> (m, 0)" means a vector having "m"
elements each of value "0".
Here these elements are vectors.
*/
vector<vector<int>> vec( n , vector<int> (m, 0));
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
cout << vec[i][j] << " ";
}
cout<< endl;
}
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us