Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = y = (size + 1) / 2;
- matrix[x][y]=1; //default of the matrix
- x1=y1=rand()%(size-1); //random selection of matrix position
- number= switch(rand() %4){
- case 0;
- matrix[x1][0]==1;
- break;
- case 1;
- matrix[size-1][y1]==1;
- break;
- case 2;
- matrix[0][y1]==1;
- break;
- case 3;
- matrix[x1][size-1]==1;
- break
- }
Add Comment
Please, Sign In to add comment