Tranfsorm an 8×4 Matrix into a 40×20 composed of 5×5 patterns

  arrays, c++, matrix

I have to transform a 8 x 4 two-dimensional array of chars into a 40 x 20 two dimensional array of {0,1}, each cell of the original array is a letter from A to F, that repreents a cetain combination of {0,1) in a 5×5, it’s kinda hard to describe so i’ll just show you what i mean:

  F  D  A  E
  E  F  F  C
  A  A  C  C
  C  C  E  B
  B  B  B  A
  A  C  F  A
  A  C  C  B
  A  A  E  E

each letter represents a 5x5 array of given combination that looks for example like this(This is the "F" variant)

0 0 1 0 0
0 0 1 0 0
1 1 1 1 1
0 0 1 0 0
0 0 1 0 0

After the transformation, the 40 x 20 array would be of type int and contain only {0,1}
Here’s my code so far:

void MacierzSegmentow(char MacierzPosegmentowana[Wymiar8][Wymiar4])
{
    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 4; j++)
            MacierzPosegmentowana[i][j] = char(rand() % 6 + 65);
}

Any help would be appreciated, I have little idea of how to do it.

Source: Windows Questions C++

LEAVE A COMMENT