Why is this for loop infinite?
I am working on creating a sort of minesweeper program in c++, and after
running some tests I found that, for some reason I cannot see, one of my
for loops never ends. I have looked over the code for quite some time now,
and cannot see the reason. thank you very much for helping me, I am
somewhat new to c++ and am very perplexed.
Here is the code: for(int r = 0; r<=8;r++){
for(int c= 0; c<=8;c++){
int num = 0;
if (realmap[r][c] != 10){
for(int r = 0; r<=8;r++){
for(int c= 0; c<=8;c++){
int num = 0;
if (realmap[r][c] != 10){
if(r-1 != -1&&realmap[r-1][c] ==10){
num++;
}...
(There are a multitude of these if statements, but i am only showing the
one to make sure the code is readable. Their basic purpose is to check the
spaces areound the space for mines.)
...realmap[r][c] = num;
Sleep(5000);
cout << "test3";
}
}
}
If you see the problem, thank you very much. I will include the rest of
the if statements if nobody can find a problem.
No comments:
Post a Comment