Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language is C++ 2. Matrix Arithmetic We are going to write a program to perform arithmetic on matrices, specifically to add and subtract them. While

image text in transcribed

Language is C++

2. Matrix Arithmetic We are going to write a program to perform arithmetic on matrices, specifically to add and subtract them. While a 2D array is a more suitable representation for a matrix, there are peculiarities with passing a 2D array to a function. We will therefore simulate the 2D structure of the matrix with a regular (10) array. Function Description You have to write the following functions. print_matrix prints the contents of the matrix passed to it. input_matirx. populates the matrix passed to it with values input form the console. add_matrices takes 3 matrices as parameters and stores the sum of the first 2 matrices in the third one subtract_matrices. takes 3 matrices as parameters and stores the difference of the first 2 matrices in the third one You may pass any additional parameters to your functions as needed. Input Format For Custom Testing The first line contains 2 integers, rand c denoting the dimension of the 2 matrices that follow. Both matrices will have rrows and columns. Each of the next rlines contains cspace separated integers corresponding to a row of the first matrix. Each of the next rlines contains cspace separated integers corresponding to a row of the second matrix. The next line contains a single character, either + or - Depending on the character, you have to output the sum or the difference respectively of the matrices

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

What is topology? Explain with examples

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago