c++ code 2d block

#include <iostream>
#include <vector>

using namespace std;

int main() {
    // Define the dimensions of the 2D block
    const int rows = 3;
    const int cols = 3;

    // Initialize a 2D vector to represent the block
    vector<vector<int>> block(rows, vector<int>(cols, 0));

    // Fill the block with values (for demonstration purposes)
    int value = 1;
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            block[i][j] = value++;
        }
    }

    // Display the 2D block
    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols; ++j) {
            cout << block[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}