Hi, it's me again...
i've a (strange) question - to write a program which gets a 2-dimension array, in the array there are binary values: 0 or 1.
I had to write 2 function:
the first - counts the lit digits - the 1-cells
the second - gets an array and limits. it has to check if there are more than 1 lit digits, if so - it has to reduce the limits, till it gets limits that include just one lit digit - 1, and than prints out it limits.
example:
1) 0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 0
=>> (0,0)(3,3)
2) 1 0 0 1
0 0 1 0
0 0 0 0
1 0 0 0
=>> (0,0)(1,1)
(3,0)(3,0)
(2,1)(2,1)
(0,2)(1,3)
etc..
It's hard to explain... hope u understood.
Here is the progam I wrote:
i've a (strange) question - to write a program which gets a 2-dimension array, in the array there are binary values: 0 or 1.
I had to write 2 function:
the first - counts the lit digits - the 1-cells
the second - gets an array and limits. it has to check if there are more than 1 lit digits, if so - it has to reduce the limits, till it gets limits that include just one lit digit - 1, and than prints out it limits.
example:
1) 0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 0
=>> (0,0)(3,3)
2) 1 0 0 1
0 0 1 0
0 0 0 0
1 0 0 0
=>> (0,0)(1,1)
(3,0)(3,0)
(2,1)(2,1)
(0,2)(1,3)
etc..
It's hard to explain... hope u understood.
Here is the progam I wrote: