Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions