Aprende programando un código de simulación del Juego Sudoku para C++
#include <iostream>
#include <vector>
using namespace std;
const int N = 9;
bool validarFila(vector<vector<int>>& tablero, int fila, int num) {
    for (int col = 0; col < N; col++) {
        if (tablero[fila][col] == num) {
            return false;
        }
    }
    return true;
}
bool validarColumna(vector<vector<int>>& tablero, int col, int num) {
    for (int fila = 0; fila < N; fila++) {
        if (tablero[fila][col] == num) {
            return false;
        }
    }
    return true;
}
bool validarSubmatriz(vector<vector<int>>& tablero, int inicioFila, int inicioCol, int num) {
    for (int fila = 0; fila < 3; fila++) {
        for (int col = 0; col < 3; col++) {
            if (tablero[inicioFila + fila][inicioCol + col] == num) {
                return false;
            }
        }
    }
    return true;
}
bool esSeguro(vector<vector<int>>& tablero, int fila, int col, int num) {
    return validarFila(tablero, fila, num) &&
           validarColumna(tablero, col, num) &&
           validarSubmatriz(tablero, fila - fila % 3, col - col % 3, num);
}
bool encontrarCasillaVacia(vector<vector<int>>& tablero, int& fila, int& col) {
    for (fila = 0; fila < N; fila++) {
        for (col = 0; col < N; col++) {
            if (tablero[fila][col] == 0) {
                return true;
            }
        }
    }
    return false;
}
bool resolverSudoku(vector<vector<int>>& tablero) {
    int fila, col;
    if (!encontrarCasillaVacia(tablero, fila, col)) {
        return true; // No hay casillas vacías, el Sudoku está resuelto
    }
    for (int num = 1; num <= 9; num++) {
        if (esSeguro(tablero, fila, col, num)) {
            tablero[fila][col] = num;
            
            if (resolverSudoku(tablero)) {
                return true;
            }
            tablero[fila][col] = 0; // Retrocede si no es una solución válida
        }
    }
    return false; // No se encontró ninguna solución válida
}
void mostrarTablero(vector<vector<int>>& tablero) {
    for (int fila = 0; fila < N; fila++) {
        for (int col = 0; col < N; col++) {
            cout << tablero[fila][col] << " ";
        }
        cout << endl;
    }
}
int main() {
    vector<vector<int>> tablero = {
        {5, 3, 0, 0, 7, 0, 0, 0, 0},
        {6, 0, 0, 1, 9, 5, 0, 0, 0},
        {0, 9, 8, 0, 0, 0, 0, 6, 0},
        {8, 0, 0, 0, 6, 0, 0, 0, 3},
        {4, 0, 0, 8, 0, 3, 0, 0, 1},
        {7, 0, 0, 0, 2, 0, 0, 0, 6},
        {0, 6, 0, 0, 0, 0, 2, 8, 0},
        {0, 0, 0, 4, 1, 9, 0, 0, 5},
        {0, 0, 0, 0, 8, 0, 0, 7, 9}
    };
    if (resolverSudoku(tablero)) {
        cout << "Solución del Sudoku:" << endl;
        mostrarTablero(tablero);
    } else {
        cout << "No se encontró solución." << endl;
    }
    return 0;
}
Pueder ir al artículo principal:
Códigos Sencillos hechos en C++

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.