tell me and we will both know
I have a 2D array that reads in a file with $ chars only in it.
I need to check a char "$" to see if it has any "$" characters in adjoining cells. What kind of coding would I use to find this? I'm stumped. Surely c++ must get easier.
do you mean something like points in a grid? I did a program once that counted the number of "blobs" (adjacent '*'s) in a nXm grid.
if I remember correctly loop through the grid looking for an occupied cell, once found delete the contents of it and use a recursive function to check each of the surrounding cells, each time deleting the contents and again calling the recursive function. keep making passes through the grid until there are no more occupied cells. make sure you make a duplicate array incase you need to output it again. I have the code lying around somewhere if you'd like it or have any other questions.
It sounds the same as the one I need to do. If you have a spare copy could you email me, your a life saver. I could kiss your feet.
here it is. forgive me for the lack of commenting but i think you'll be able to figure it out.
you'll have to modify it a bit for your specs but it's just minor changes.