Write a C++ program that will dynamically allocate a 2D array of size MxN, where M and N will be entered by the user. Program should fill the MxN matrix according to the following criteria: Generate random numbers in the range 120 to 340 and fill the diagonal entries in the matrix. Each element in the upper triangular matrix will be calculated by adding its left and bottom neighbor elements. Each element in the lower triangular matrix will be calculated by subtracting the top element from the element on the right. Element in Upper Triangular Matrix = Left Element + Bottom Element Element in Lower Triangular Matrix = Right Element – Top Element (A sample 5x5 matrix is filled for you) 89 500 1100 1955 3886 322 411 600 855 1931 -544 -222 189 255 1076 643 99 -123 66 821 70 713 812 689 755 Program will display the filled matrix in tabular form on the screen and delete the dynamically allocated 2D array before terminating.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a C++ program that will dynamically allocate a 2D array of size MxN, where M
and N will be entered by the user. Program should fill the MxN matrix according to the
following criteria:
Generate random numbers in the range 120 to 340 and fill the diagonal entries in the
matrix. Each element in the upper triangular matrix will be calculated by adding its left
and bottom neighbor elements. Each element in the lower triangular matrix will be
calculated by subtracting the top element from the element on the right.
Element in Upper Triangular Matrix = Left Element + Bottom Element
Element in Lower Triangular Matrix Right Element - Top Element
(A sample 5x5 matrix is filled for you )
89
500
1100
1955
3886
322
411
600
855
1931
544
-222
189
255
1076
643
99
-123
66
821
70
713
812
689
755
Program will display the filled matrix in tabular form on the screen and delete the
dynamically allocated 21 array before terminating.
Transcribed Image Text:Write a C++ program that will dynamically allocate a 2D array of size MxN, where M and N will be entered by the user. Program should fill the MxN matrix according to the following criteria: Generate random numbers in the range 120 to 340 and fill the diagonal entries in the matrix. Each element in the upper triangular matrix will be calculated by adding its left and bottom neighbor elements. Each element in the lower triangular matrix will be calculated by subtracting the top element from the element on the right. Element in Upper Triangular Matrix = Left Element + Bottom Element Element in Lower Triangular Matrix Right Element - Top Element (A sample 5x5 matrix is filled for you ) 89 500 1100 1955 3886 322 411 600 855 1931 544 -222 189 255 1076 643 99 -123 66 821 70 713 812 689 755 Program will display the filled matrix in tabular form on the screen and delete the dynamically allocated 21 array before terminating.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY