1. Engineering
  2. Computer Science
  3. problem statement write a c program that will dynamically allocate...

Question: problem statement write a c program that will dynamically allocate...

Question details

Problem Statement Write a C++ program that will dynamically allocate a non contiguous void delete2Dmatrix(int *matrix, int rows) two-dimensional array (matrix) of integers, meaning you will need to create each row of col- int sumMatrixRow(int *matrix, int row, int columns) umns separate. Your program should first open a file named matrix.dat and read the size void displayMatrix(ofstream &out, int matrix, int row, int column) of the matrix. The first and second lines of the file will contain the number of rows and the num-Once your program has created and filled the two-dimensional array ber of columns respectively The remaining lines of the file will contain a tuple, three integers rep- reported in the format below and the row and column sums should be resenting the row, column and data value for an element in the matrix. You will need to verify whether that row and column exist in the matrix before filling that element. Gracefully skip row, col umn, value tuples that do not exist in the matrix. If a particular matrix element is not listed the data value should be assumed to be zero Deliverables: proj1-testfunctions.cpp (this is your testing driver to test all your func- 0 3 3 tions apart from using them in the solution) proj1-main.cpp (this is your solution driver) proj1-matrix.cpp (this is your implementation of the matrix related functions file, included both in test and driver files) proj1-matrix.cpp (Functions to implement from proj1-matrix.hpp) int *create2Dmatrix(int rows, int columns) void addMatrixValue(int *matrix, int row, int column, int value) int sumMatrixColumn(int matrix, int column, int rows) (matrix) the matrix should be calculated and reported in the format below. Finally, any dynamically allocated memory should be returned to the heap using the delete command Example matrix.dat 0 4 22 1 0 -3 2 2 -10 2 0 18 1 1 25 0 2 -15

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution