Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

C++ Based on this question asked here:...

Answered: 1 week ago

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago