Question: C++ 1. Matrix class that stores and operate on a dynamic two-dimensional array. The class has the following structure: Private member variables: - int **

C++

1. Matrix class that stores and operate on a dynamic two-dimensional array. The class has the following structure:

Private member variables:

- int ** mat;

- int rows;

- int cols;

Public member functions:

+Default constructor: sets both rows and cols to 3 and creates 3x3 matrix dynamically

+Parameterized constructor: sets the rows and cols to the values passed to the constructor and create a matrix with the given dimensions.

+Destructor: deallocates the dynamically-allocated array. Make sure to delete both dimensions.

+AcceptValues: fill the array with values from the user.

+PrintValues: prints the matrix elements.

2. Create a main where you create a matrix, accept values in it, and then print them.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!