We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aad46f3 commit 41bc7feCopy full SHA for 41bc7fe
Convert.cpp
@@ -0,0 +1,38 @@
1
+#include<iostream>
2
+using namespace std;
3
+int main()
4
+{
5
+ int n,m,i,j,k,count=0;
6
+ cin>>n>>m;
7
+ k=n*m;
8
+ int arr1[n][m];
9
+ int arr2[k];
10
+ for(i=0;i<n;i++)
11
+ {
12
+ for(j=0;j<m;j++)
13
14
+ cin>>arr1[i][j];
15
+ }
16
17
18
19
20
21
+ arr2[count++]=arr1[i][j];
22
23
24
+ cout<<"Displaying 2D array\n";
25
26
27
28
29
+ cout<<arr1[i][j]<<"\t";
30
31
+ cout<<"\n";
32
33
+ cout<<"Displaying 1D array\n";
34
+ for(i=0;i<k;i++)
35
36
+ cout<<arr2[i]<<"\t";
37
38
+}
0 commit comments