diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp |
Initial commit
Diffstat (limited to 'macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp')
-rw-r--r-- | macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp b/macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp new file mode 100644 index 0000000000..74cbb40857 --- /dev/null +++ b/macros/latex/contrib/mcmthesis/code/mcmthesis-sudoku.cpp @@ -0,0 +1,41 @@ +//============================================================================ +// Name : Sudoku.cpp +// Author : wzlf11 +// Version : a.0 +// Copyright : Your copyright notice +// Description : Sudoku in C++. +//============================================================================ + +#include <iostream> +#include <cstdlib> +#include <ctime> + +using namespace std; + +int table[9][9]; + +int main() { + + for(int i = 0; i < 9; i++){ + table[0][i] = i + 1; + } + + srand((unsigned int)time(NULL)); + + shuffle((int *)&table[0], 9); + + while(!put_line(1)) + { + shuffle((int *)&table[0], 9); + } + + for(int x = 0; x < 9; x++){ + for(int y = 0; y < 9; y++){ + cout << table[x][y] << " "; + } + + cout << endl; + } + + return 0; +} |