File tree 4 files changed +42
-0
lines changed
4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * 2 DIMENSIONAL ARRAYS
3
+ */
4
+
5
+ #include < iostream>
6
+ using namespace std ;
7
+ int main ()
8
+ {
9
+ int rows;
10
+ int cols;
11
+ cout << " Enter rows and cols of 2d array" <<endl;
12
+ cin >> rows >> cols;
13
+ int arr[rows][cols];
14
+ cout << " Enter the elements of the array" <<endl;
15
+ for (int i=0 ;i<rows;i++)
16
+ {
17
+ for (int j=0 ;j<cols;j++)
18
+ {
19
+ cin >> arr[i][j];
20
+ }
21
+ }
22
+ cout << " Entered elements of 2d array" <<endl;
23
+ for (int i=0 ;i<rows;i++)
24
+ {
25
+ for (int j=0 ;j<cols;j++)
26
+ {
27
+ if (j==cols-1 )
28
+ {
29
+ cout << arr[i][j] << endl;
30
+ }
31
+ else
32
+ {
33
+ cout << arr[i][j] << " " ;
34
+ }
35
+ }
36
+ }
37
+ }
Original file line number Diff line number Diff line change 8
8
9
9
#### ARRAYS
10
10
11
+ * [ ONE DIMENSIONAL ARRAY] ( Data-Structures/ARRAYS/1darrays.cpp )
12
+ * [ TWO DIMENSIONAL ARRAY] ( Data-Structures/ARRAYS/2darrays.cpp )
13
+ * [ THREE DIMENSIONAL ARRAY] ( Data-Structures/ARRAYS/3darrays.cpp )
14
+ * [ FOUR DIMENSIONAL ARRAY] ( Data-Structures/ARRAYS/4darrays.cpp )
15
+
11
16
#### LISTS
12
17
13
18
* LINKED-LIST
You can’t perform that action at this time.
0 commit comments