L'idea è questa
codice:#define M 30 #include <time.h> .... char scacchiera[M][M]; int i, x,y; srand(time(NULL)); for(i=0; i<50; i++) { x=rand()%50; y=rand()%50; if(scacchiera[x][y]!='X') scacchiera[x][y]='X'; else i--; }
L'idea è questa
codice:#define M 30 #include <time.h> .... char scacchiera[M][M]; int i, x,y; srand(time(NULL)); for(i=0; i<50; i++) { x=rand()%50; y=rand()%50; if(scacchiera[x][y]!='X') scacchiera[x][y]='X'; else i--; }