Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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).

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions