-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiDimentionalArrays.cpp
More file actions
37 lines (31 loc) · 903 Bytes
/
multiDimentionalArrays.cpp
File metadata and controls
37 lines (31 loc) · 903 Bytes
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
#include <iostream>
int main()
{
const int rows = 5;
const int colums = 5;
int twoDimensionalArray[rows][colums]{{0, 0, 0, 0, 0}, // Create a 2D array
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}};
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < colums; j++)
{
std::cout << twoDimensionalArray[i][j] << " ";
}
std::cout << '\n';
}
std::cout << '\n';
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < colums; j++)
{
twoDimensionalArray[i][j] = i + j;
std::cout << twoDimensionalArray[i][j] << " ";
}
std::cout << '\n';
}
std::cout << '\n';
return 0;
}