Skip to content

Commit deb0998

Browse files
authored
Merge pull request #27 from MHMITHUN/patch-3
Create Multi – Dimensional Array.cpp
2 parents 2df6b90 + 5bc4fbb commit deb0998

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Multi – Dimensional Array.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream.h>
2+
3+
int main () {
4+
5+
// an array with 5 rows and 2 columns.
6+
7+
int a[5][2] = { {0,0}, {1,2}, {2,4}, {3,6},{4,8}};
8+
9+
10+
11+
// output each array element's value
12+
13+
for ( int i = 0; i < 5; i++ )
14+
15+
for ( int j = 0; j < 2; j++ ) {
16+
17+
18+
19+
cout << "a[" << i << "][" << j << "]: ";
20+
21+
cout << a[i][j]<< endl;
22+
23+
}

0 commit comments

Comments
 (0)