### 2d array help

I'm pretty confused on how to compare two "cells" in a 2 dimensional array. Im almost sure it's something with in my logic when checking the cells... any help on how i could check this would be great, thank you in advance for any help!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142`` ``````#include #include using namespace std; int main() { //variables int row_count(0); int col_count(0); int i, j; int count(0); char willdie('\$'); char dead('&'); char alive('*'); const int nrows(25); const int ncols(25); char global [25][25]; char world[nrows][ncols]; //generation one for (i=0;i2||count<2) { global[i][j]=willdie; } if(count=2) { global[i][j]=alive; } count=0; //reset count for each cell }//end of j loop }//end of for loop to check alive cells for (i=0;i
to be more clear what i mean by a cell would be like comparing..

[1][1] to [0][0],[0][1],[0][2],[1][0],[1][2],[2][0],[2][1],[2][2]
I changed one mistake with assigning in the if statement and changed it to a condition operator

...i.e
 `` `` ``if ( global[i+1][j+1]==alive)``
Topic archived. No new replies allowed.