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:
|
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).
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started