c++ - One number appears only once? -


so i've been trying write function generate numbers sudoku puzzle. looks like.

i'm kind of lost @ last line... how can check if 1 number appears in 1 row , 1 column?

void generator (int row, int col){      (int i=0; i<9; i++){         int randnum= (1+rand()%9);         (int j=0; j<i; j++){             a[i][j]=randnum;             //check if 1 number appears once.          }      } } 

you doing wrong.

you should fill sudoku according rules, starting 1.

after have valid sudoku, switch numbers randomly using random permutation.

do note pretty complex problem (if include actual sudoku generation, not filled board) , underestimating it.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -