#include <iostream>
#include <vector>
int main() {
// Create a 2D array using vectors
std::vector<std::vector<int>> matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
// Define the scalar value to be added
int scalar = 10;
// Iterate through the rows of the matrix
for (std::vector<int>& row : matrix) {
// Iterate through the elements of each row
for (int& element : row) {
// Add the scalar value to each element
element += scalar;
}
}
// Display the updated matrix
for (const std::vector<int>& row : matrix) {
for (int element : row) {
std::cout << element << " ";
}
std::cout << std::endl;
}
return 0;
}