Hi, what im trying to do is get this description to work (which i have on another thread):
A Computer graphics image is composed of rectangular points on the screen. In a black and white picture, we can use 0 to represent white and 1 for black. The picture is a 5 x 5 square on the screen as follows:
1 1 0 1 0 1 1 0 0 0
1 0 0 1 1 1 0 0 0 0
1 0 1 1 1 1 0 0 0 0
0 1 [/b]1 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
(initial image) (image after exe of ErasePic function)
Two black pixels are part of the same object if we can get from one to the other with horizontal and vertical moves. Thus, Fig 1(initial image) contains 2 objects.
Write a function ErasePic to erase the object of which the given black pixel is part. Invoking the function for the bold face 1 results in erasing a representation of the rightmost object of Fig 1 (see Fig 2).
Someone recommended this, which i tried to execute and its not working. here is the code and the errors I get:
Errors
subscript requires array or pointer type
missing ';' before '||'
syntax error : 'if'
'FindBlcok' : undeclared identifier
subscript requires array or pointer type
subscript requires array or pointer type
'=' : left operand must be l-value
warning C4508: 'ClearBlock' : function should return a value; 'void' return type assumed
'xy' : undeclared identifier
'ClearBlock' : function does not take 0 parameters
warning: 'ErasePic' : function should return a value; 'void' return type assumed
If someone can show me what is wrong with this, ive been at this for hrs, i would really appreciate it. Thanks alot!!
GOD BLESS AMERICA
A Computer graphics image is composed of rectangular points on the screen. In a black and white picture, we can use 0 to represent white and 1 for black. The picture is a 5 x 5 square on the screen as follows:
1 1 0 1 0 1 1 0 0 0
1 0 0 1 1 1 0 0 0 0
1 0 1 1 1 1 0 0 0 0
0 1 [/b]1 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
(initial image) (image after exe of ErasePic function)
Two black pixels are part of the same object if we can get from one to the other with horizontal and vertical moves. Thus, Fig 1(initial image) contains 2 objects.
Write a function ErasePic to erase the object of which the given black pixel is part. Invoking the function for the bold face 1 results in erasing a representation of the rightmost object of Fig 1 (see Fig 2).
Someone recommended this, which i tried to execute and its not working. here is the code and the errors I get:
Code:
void FindBlock(int *aBmp, int nSize, int cx, int cy){
if (aBmp[cx][cy] == 0) || aBmp[cx][cy] > 1; return
if (aBmp[cx][cy] == 1) || aBmp[cx][cy] +1000;
if (cx > 0) FindBlock(aBmp, nSize, cx-1, cy);
if (cx < nSize -1) FindBlock(aBmp, nSize, cx+1, cy);
if (cy > 0) FindBlcok(aBmp, nSize, cy, cy-1);
if (cy < nSize-1) FindBlock(aBmp, nSize, cx, cy+1);
}
ClearBlock(int *aBmp, int nSize) {
for (int m=0; m < nSize; m++)
for (int n=0; n < nSize; n++)
if (aBmp[m][n] > 1) aBmp[m][n] = 0;
}
ErasePic(int *aBmp, int nSize, int cx, int cy) {
FindBlock(aBmp, nSize, cx, xy);
ClearBlock();
}
subscript requires array or pointer type
missing ';' before '||'
syntax error : 'if'
'FindBlcok' : undeclared identifier
subscript requires array or pointer type
subscript requires array or pointer type
'=' : left operand must be l-value
warning C4508: 'ClearBlock' : function should return a value; 'void' return type assumed
'xy' : undeclared identifier
'ClearBlock' : function does not take 0 parameters
warning: 'ErasePic' : function should return a value; 'void' return type assumed
If someone can show me what is wrong with this, ive been at this for hrs, i would really appreciate it. Thanks alot!!
GOD BLESS AMERICA