Question: Write a full C++program to do the following processes on a two-dimension arrayof integers. Assume the size is 4x4. 1- [30%] Fill the array with

Write a full C++program to do the following processes on a two-dimension arrayof integers. Assume the size is 4x4.

1- [30%] Fill the array with the numbers like this pattern (auto-generatedby your program):

1 1 1 1

2 2 2 2

3 3 3 3

4 4 4 4

Note: Do not accept the values as input, or hard codeit. Find the math to generate these numbers and fill the array with them.

2- [30%] Reset themain diagonal elementsof the array (assign the number Zero to the elements falling in the main diagonal as in the example below) :

This means all the elements that fall in the main diagonal will be 0. See this example:

The result will be like this:

01 1 1

202 2

3 303

4 4 40

Note: Again find the relationship among these items in the main diagonal and update the valuesto be Zeros. Do not enter them manually.

3- [30%]Create a function named Sum to find the summation ofeach rowof the array. So pass thearray and the row number that you want to calculate to the function and return the sum of it.

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!