/// @file /// @brief task C /// g++ -std=c++20 -Imodules taskC.cpp -o taskC && ./taskC /// @todo include modules library header for using iue::io::savetxt #include #include #include /// @todo write a function initalizing a 'vector of vectors' with an integer sequence, details see main.ipynb std::vector> initMatrix(int m, int n) { std::vector> matrix; double value = 1.0; for (int i = 0; i < m; i++) { std::vector row; for (int j = 0; j < n; j++) { row.push_back(value); value++; } matrix.push_back(row); } return matrix; } /// @todo write a function to write a 'vector of vectors' to a csv-file, details see main.ipynb void writeMatrix(std::vector> matrix, std::string filename) { std::ofstream file(filename); for (auto row : matrix) { for (auto i : row) { file << i << ","; } file << std::endl; } file.close(); } /// @todo write a main-function and use your function to /// - init a 'vector of vectors' to initialize a table and /// - write the table to a csv-file using iue::io::savetxt int main() { std::vector> matrix = initMatrix(3, 4); writeMatrix(matrix, "matrix.csv"); }