samedi 24 octobre 2015

I cant understand why this loop freezes

Can someone please explain to me whats wrong with this code?? shouldnt my board be filled? ( i have two functions above, one to generate a random number and the other to print the array)

srand( time(NULL) );
    int r,c,ui,cntr,cntr2,ran,g,x;
    char kb, aray[3][3]={{'.','.','.'},{'.','.','.'},{'.','.','.'}};
    getRand();
    ran=getRand();

for(cntr2=0;cntr2<5;cntr2++){
                g=ran/3;
                x=ran%3;
                if(aray[g][x]=='.'){
                    aray[g][x]='O';
                    system("cls");
                    map(aray);
                }
                else{
                    cntr2--;
                }

        }

Aucun commentaire:

Enregistrer un commentaire