ok so here is what im doin.
Given a square matrix, write a program that determines the number of white(numbered) blocks and total number of squares in each of the white blocks. By definition, the outside boundaries of the matrix must be shaded(0). A block of white squares consists of all of the white squares whose side boundaries are next to another white square. White squares that touch only a diagonal point are not adjacent. Accommodate a maximum of 10 blocks and a maximum matrix of 10 x 10 .
In the diagram below, block 1 contains three squares, and block 4 contains nine squares. Note that block 3 contains only one square. It touches block 1 only on the diagonal.
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 2 2 2 2 0
0 1 1 0 0 2 2 2 2 0
0 0 0 3 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 4 4 4 4 4 0 0
0 0 0 0 4 4 4 0 0 0
0 0 0 0 0 4 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
Obtain the square definition from a text file. The file should contain a square matrix composed of zeros for shaded squares and non-zeros for the white squares. The input for the diagram above is shown below.
.input:
0000000000
0010022220
0110022220
0003000000
0000000000
0004444400
0000444000
0000040000
0000000000
0000000000
the only think i have a question on how to do it is how will i print out how many squares there are in each block?