A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d3/d05/sudoku__solver_8cpp.html below:

TheAlgorithms/C++: backtracking/sudoku_solver.cpp File Reference

Main function.

154 {

155 const int V = 9;

156 std::array<std::array<int, V>, V> mat = {

157 std::array<int, V>{5, 3, 0, 0, 7, 0, 0, 0, 0},

158 std::array<int, V>{6, 0, 0, 1, 9, 5, 0, 0, 0},

159 std::array<int, V>{0, 9, 8, 0, 0, 0, 0, 6, 0},

160 std::array<int, V>{8, 0, 0, 0, 6, 0, 0, 0, 3},

161 std::array<int, V>{4, 0, 0, 8, 0, 3, 0, 0, 1},

162 std::array<int, V>{7, 0, 0, 0, 2, 0, 0, 0, 6},

163 std::array<int, V>{0, 6, 0, 0, 0, 0, 2, 8, 0},

164 std::array<int, V>{0, 0, 0, 4, 1, 9, 0, 0, 5},

165 std::array<int, V>{0, 0, 0, 0, 8, 0, 0, 7, 9}};

166

168 std::cout << "Solution " << std::endl;

169 std::array<std::array<int, V>, V> starting_mat = mat;

171

172 return 0;

173}

void printMat(const std::array< std::array< int, V >, V > &mat, const std::array< std::array< int, V >, V > &starting_mat, int n)

Utility function to print the matrix.

bool solveSudoku(std::array< std::array< int, V >, V > &mat, const std::array< std::array< int, V >, V > &starting_mat, int i, int j)

Main function to implement the Sudoku algorithm.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4