Question: Warm-up 1) Array Initialize Suppose you wanted to pass in a matrix (2D array) to be initialized by a function to the identity matrix (1s
Warm-up
1) Array Initialize
Suppose you wanted to pass in a matrix (2D array) to be initialized by a function to the identity matrix (1s on the diagonal, 0s elsewhere). Make a function named identity that takes in a 2D array from main along with a size (assume a square matrix). (Hint: think about what issues occur and how you can get past them).
Then make a function named display that again takes in a 2D matrix and size to print the array. Call this on the array after passing it into identity.
Examples:
What size matrix?
3
1 0 0
0 1 0
0 0 1
What size matrix?
5
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
*PLEASE CODE IN C++*
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
