/// @file /// @brief Task1: "single-file" excutable C++ program #include #include /// @brief Calculate the sum of all integer values in a std::vector> /// @param data A vector of vectors containing the values to be summed /// @return Sum of all values in data double sum(const std::vector>& data) { double sum = 0; for (const auto& row : data) { for (const auto& value : row) { sum += value; } } return sum; } /// @brief main function (entry point for executable) conducting the following tasks in this order /// - create and prepare a local variable of type std::vector> /// holding 9 int values in this arrangement: /// 1, 2, 3 /// 4, 5, 6 /// 7, 8, 9 /// - call your function 'sum' and provide the prepared variable as argument to the call /// - capture the result of your function call in a local variable and print it to the console int main() { std::vector> data = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; double result = sum(data); std::cout << "Sum: " << result << std::endl; return 0; }