Originally Posted by
-EquinoX-
Well a 2d array of size [100][100] could work, however isn't this the same as declaring 100 single array?
Maybe? I suppose it depends on what you think "100 single array" means. I would declare it like so:
Code:
#define MAXSIZE 100
int connections[MAXSIZE][MAXSIZE] = { {0} };
were it I doing the work. Then if country 1 was connected to country 3, I would set both connections[1][3] and connections[3][1] to 1.
Originally Posted by
-EquinoX-
I would also want so that I can disconnect the countries which is adjacent/connected easily. So in the example above, say that I want to disconnect country 1 and 2. Then it will be:
Country 01 : 03
Country 03 : 01 04
Country 04 : 03
You would unhook in very much the same way.
Edit to add: I suppose I should mention that I'm assuming country numbering is the same as array numbering. If my countries are instead numbered 1 through 100, I would subtract 1 before using the country number as an array index.