- Notifications
You must be signed in to change notification settings - Fork 366
/
Copy path2d-Dynamic.cpp
43 lines (36 loc) · 781 Bytes
/
2d-Dynamic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
usingnamespacestd;
#definelllonglong
#definepb push_back
#definemod1000000007
#defineendl'\n'
intmain(){
cin.tie(0)->sync_with_stdio(0);
int n,m;
cin>>n>>m;
// creation of 2array
//
int **arr= newint *[n];
for (int i = 0; i < n; i++) {
arr[i]= newint[n];
}
// taking input
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin>>arr[i][j];
}
}
// giving the outputl
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout<<arr[i][j]<<"";
}
cout<<endl;
}
//releasing of all the heap memory
for (int i = 0; i < n; i++) {
delete [] arr[i];
}
delete []arr;
return0;
}