Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3612907 • Letter: 0

Question

0 0 0 0 0 0 0 0 0 0

0 0 0 1 1 1 0 0 0 0

0 0 1 1 1 1 1 0 0 0

0 0 0 1 1 1 0 0 0 0

0 0 0 0 0 0 0 0 0 0

In analyzing a binary picture it is often necessary to identifythe edges. Let us define an element of the picture (called apixel) to be an edge pixel if it is a 1 and at least on e of thepixels immediately above, below, left and right is 0. We canthen show the edges by setting each edge pixel to 1 and all otherpixels to 0. After identifying the edges, in the precedingpicture, we obtain

0 0 0 0 0 0 0 0 0 0

0 0 0 1 1 1 0 0 0 0

0 0 1 0 0 0 1 0 0 0

0 0 0 1 1 1 0 0 0 0

0 0 0 0 0 0 0 0 0 0

Some suggestions for doing this assignment: (please state thename of each function and what it does)

1.      Use two matrices – onematrix has the present picture, the second matrix stores thepicture showing the edges.

2.      Format your output. If thedisplay does not look like a matrix, it will be difficult debuggingyour program.

Explanation / Answer

please rate - thanks sample run Enter row 1x if done: 0000000000 Enter row 2x if done: 0001110000 Enter row 3x if done: 0011111000 Enter row 4x if done: 0001110000 Enter row 5x if done: 0000000000 Enter row 6x if done: x Starting picture 0000000000 0001110000 0011111000 0001110000 0000000000 Starting outline Ending outline 0000000000 0001110000 0010001000 0001110000 0000000000 code #include #include void printmat(char[][10],int); void getedge(char [][10],char[][10],int ); int main() {int i,j,rows; char mat[10][10],newmat[10][10]={' '}; for(i=0;i