Merge pull request #165 from shekhar135/master

dynamic 2d array
This commit is contained in:
Luke Oliff 2018-10-06 09:40:11 -07:00 committed by GitHub
commit 760bff0748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

26
code/dynamic_2d_array.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
#include<vector>
using namespace std;
int main() {
int m;
cin>>m;
int *arr = new int[m*m];
for(int i=0;i<m;i++)
{
for(int j=0;j<m;j++)
{
cin>>arr[i*m+j];
}
}
for(int i=0;i<m;i++)
{
cout<<endl;
for(int j=0;j<m;j++)
{
cout<<arr[i*m+j]<<"\t";
}
}
}