Question: Write a complete C++ program that performs the following (both requirements): - Initialize a two-dimensional array of type integer with 4 rows and 4 columns
Write a complete C++ program that performs the following (both requirements): - Initialize a two-dimensional array of type integer with 4 rows and 4 columns and fill it with the exact values (same numbers in the same order) as the array below ( 2 marks): - Finds the sum of the elements in the diagonal using a function called Sum (3 marks). Use the prototype: int Sum(double myArrayl [4], int row) as your function header. For example, after calling Sum function and passing the above array with row equals to 4 , the function will return the sum of the diagonal, which is 5 , since it adds 1+2+0+2. Your function should work on ANY array with the same dimensions passed, not just the one above and not only the numbers above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
