"how to Use array (one-dimension or two-dimension) to store the input data from file and the output data in c++" code example
Example 1: c fill 2d array
// Either
int disp[2][4] = {
{10, 11, 12, 13},
{14, 15, 16, 17}
};
// Or
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
// OR
int i, j;
for (i = 0; i < HEIGHT; i++) { // iterate through rows
for (j = 0; j < WIDTH; j++) { // iterate through columns
disp[i][j] = disp[i][j];
}
}
Example 2: matrix c declaration
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
Example 3: double array in c
int disp[2][4] = {
{10, 11, 12, 13},
{14, 15, 16, 17}
};