#include <iostream>
#include <vector>
int main() {
// Step 1: Include necessary header files
#include <iostream>
#include <vector>
// Step 2: Declare a 2D vector using the vector template class
std::vector<std::vector<int>> twoDVector;
// Step 3: Specify the dimensions and initialize the 2D vector
int rows = 3; // Number of rows
int cols = 4; // Number of columns
twoDVector.resize(rows, std::vector<int>(cols, 0));
// Step 4: Access and modify elements of the 2D vector
twoDVector[0][1] = 5; // Assign a value to an element in the first row, second column
// Step 5: Print the elements of the 2D vector
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
std::cout << twoDVector[i][j] << " ";
}
std::cout << std::endl;
}
return 0;
}