Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need some help with this C++ programming assignment. The assignment is as follows: Program Assignment Matrix Write a C++ program to add and subtract

I need some help with this C++ programming assignment. The assignment is as follows:

Program Assignment Matrix

Write a C++ program to add and subtract matrices.

Some hints:

A matrix can be implemented using a two-dimensional array.

You can create a matrix class. Implement constructor(s), overload assignment operator (=), input operator (>>), output operator (<<), addition operator, subtraction operator.

Example of program output:

--------------------------------------------------------------

1. Enter matrices 1 and 2

2. Display matrices 1, 2, and 3

3. m3 = m1 + m2

4. m3 = m1 - m2

5. Exit

--------------------------------------------------------------

Selection: 1

**** Enter matrix 1 and 2

How many rows (1-10): 2

How many columns (1-10): 3

Enter elements

m[0][0] = 1

m[0][1] = 2

m[0][2] = 3

m[1][0] = 4

m[1][1] = 5

m[1][2] = 6

How many rows (1-10): 2

How many columns (1-10): 3

Enter elements

m[0][0] = 1

m[0][1] = 1

m[0][2] = 1

m[1][0] = 2

m[1][1] = 2

m[1][2] = 2

--------------------------------------------------------------

1. Enter matrices 1 and 2

2. Display matrices 1, 2, and 3

3. m3 = m1 + m2

4. m3 = m1 - m2

5. Exit

--------------------------------------------------------------

Selection: 3 Matrices added.

Select 2 to see the result.

--------------------------------------------------------------

1. Enter matrices 1 and 2

2. Display matrices 1, 2, and 3

3. m3 = m1 + m2

4. m3 = m1 - m2

5. Exit

--------------------------------------------------------------

Selection: 2

**** Matrix 1 - 2x3

1 2 3

4 5 6

**** Matrix 2 - 2x3

1 1 1

2 2 2

**** Matrix 3 - 2x3

2 3 4

6 7 8

--------------------------------------------------------------

1. Enter matrice 1 and 2

2. Display matrices 1, 2, and 3

3. m3 = m1 + m2

4. m3 = m1 - m2

5. Exit

--------------------------------------------------------------

Selection:

Thank you for any help in advance.

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions