Question: C++ In class Exercise ICE 3/8 - Due on or before 10:00pm Objective: Two dimensional arrays Important instructions: All programs must include comments at the

C++

In class Exercise ICE 3/8 - Due on or before 10:00pm

Objective: Two dimensional arrays

Important instructions:

  • All programs must include comments at the top of your program: your name, course name-section number (e.g. CSIT 839 -26953), program name and the program description in brief.
  • Copy and paste your program code and outputs in Part B of each program.
  • Once it is done, save and submit this word file via Canvas.

SumOfDiagonal.cpp

Write a program that reads a 4-by-4 matrix and display the sum of all its elements on the major diagonal, sub-diagonal (below major diagonal) and super-diagonal (above major diagonal).

C++ In class Exercise ICE 3/8 - Due on or before 10:00pm

Sample Output:

Enter a 4 by 4 matrix row by row:

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Sum of the elements in the major diagonal is 34

Sum of the elements in the sub-diagonal is 30

Sum of the elements in the super-diagonal is 21

Given function prototypes

double sumMajorDiagonal(const double m[][SIZE]);

double sumSubDiagonal(const double m[][SIZE]);

double sumSuperDiagonal(const double m[][SIZE]);

Copy and paste your program (source) code and the outputs after this line

+++++++++++++++++++++++++++++++++++++++++++++++++

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!