Question: IN c++ enhance understanding in pointer and arrays(2d arrays specifically). Use c++ to write a program that will use functions for the following points. 1.Reading

IN c++ enhance understanding in pointer and arrays(2d arrays specifically). Use c++ to write a program that will use functions for the following points.

1.Reading input You will be given two numbers , e.g., m and n, where m is matrix row and n is matrix column.

2.Memory allocation After validation for m and n (positive numbers!), define two matrices M (m n) and N (m n). These two matrices could be initialized with double-dimensional array in C++, e.g., double **matrixM, **matrixN, by means of new in C++.

3.Matrix initialization Initialize matrix elements with random double number in C++. Elements in matrixM (the first matrix) should be a random double in range [-m,m], while elements in matrixN (the second matrix) in range [-n,n]. Might see randomization here.

4.Matrix addition Create a third matrixC from the addition of matrixA and matrixB.

5.Element print Print the smallest and largest element in matrixC by traversing on and comparing all elements.

6.Memory Release Release memory for all three matrices by using delete.

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 Databases Questions!