Help - Grid and recursive function

Hey guys, I am kind of new with C++. I have an assignment to do which is similar to this one:
http://uenics.evansville.edu/~hwang/f07-courses/cs215/project2.html
My problems are how to read I/O files and how to actually DO this program. I am really lost with it.

Thanks
I would start by making and 3 dimensional array 8x8x2.

Obviosly first two dimensions would be the grid, but third one would make it two grid on each other.

Then I would read file by each symbol and write it [x][x][0] array.

And then it would be very easy. I would loop trough array [x][x][0].

would look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
char symboy = 'a';
for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
         if ( grid[i][j][0].isAsterik()){
              defineBlob(i,j,symbol);
         }
    }
}

defineBlob(int i, int j, char symbol){
/*
There comes all the logic

Im to lazy to write logic for you but I will try to explain.

so first you check if  grid[i][j][1] is defined as Letter if it is you do nothing

if it is not you set a letter to it and check surroundings 
(ofcourse you check if it is in array first i-1 >= 0 and so on)

and then check if it has a letter(if it dont have call defineBlob(i-1,j,symbol))

it would look something like this:

if(..........)
  defineBlob(i-1,j,symbol);

if(..........)
  defineBlob(i+1,j,symbol);

if(..........)
  defineBlob(i,j-1,symbol);

if(..........)
  defineBlob(i,j+1,symbol);

symbol++;
return



*/
}


Topic archived. No new replies allowed.