Question: Goal : Your assignment is to write a C++ program to determine whether the value stored an m n matrix corresponds correctly to a given

Goal: Your assignment is to write a C++ program to determine whether the value stored an m n matrix corresponds correctly to a given operation of other two matrices. This assignment allows you to practice working with two-dimensional arrays.

Goal: Your assignment is to write a C++ program to determine whether

the value stored an m n matrix corresponds correctly to a given

operation of other two matrices. This assignment allows you to practice working

with two-dimensional arrays. CSC 2430 Winter 2018 LAB 4 - Matrix Operations

Verifier ue: Check Canvas Goal: Your assignment is to write a C++

program to determine whether the value stored an mxn matrix corresponds correctly

CSC 2430 Winter 2018 LAB 4 - Matrix Operations Verifier ue: Check Canvas Goal: Your assignment is to write a C++ program to determine whether the value stored an mxn matrix corresponds correctly to a given operation of other two matrices. This assignment allows you to practice working with two-dimensional rrays What operations will you code? Matrix Addition -1 0 41 0 4 7 5 1 91 7 6 16 Matrix Subtraction 1 4 31 -1 0 41 2 4-1 2 5 7]L5 1 9 3 4-2 Matrix Multiplication (Extra Credit) 7 16 16 33 Approach: You will use an ADT to represent a matrix and store the values of it. Your main program will prompt for a file that contains the dimensions of the matrix and the numerical values each row on a line and each value separated by a space. Your ADT will read the matrix from file using the ReadMatrix function. This function will read first the dimensions of the matrix: m, n. Then it will proceed to read m*n values from the file. After reading the first matrix, it will read the second matrix the same way. Note that these two matrices may not have the same dimensions. After reading the operands, the file contains in a single line a single character indicating the operation (+, -, *), your program will read it. Finally, the program will use again the ReadMatrix function to read the "supposedly" result of operating the first two matrices. At the end of reading the file, your program will have in memory three matrices and one character indicating the operation. The program then will check if the third matrix has the correct values for the operation, if it does, then it will output a message indicating that the values are correct, if not it will indicate that the result is incorrect. At the end of this document, there is a sample run of the main program. Input File Format The input file format description (look at picture): First line: contains two integer (m, n) numbers that represent the dimension of the following matrix. (First operand) Next m lines: contain n numbers each that represent the values for each position of the matrix. Next line: contains two integer (m, n') numbers that represent the dimension of the following matrix. (Second operand) Next m lines: contain n numbers each that represent the values for each position of the matrix Next line: a single character (+, -, or *) that represents the operation to do Next line: contains two integer (m", n") numbers that represent the dimension of the following matrix. (Result) Next m" lines: contain n" numbers each that represent the values for each position of the matrix CSC 2430 Winter 2018 LAB 4 - Matrix Operations Verifier ue: Check Canvas Goal: Your assignment is to write a C++ program to determine whether the value stored an mxn matrix corresponds correctly to a given operation of other two matrices. This assignment allows you to practice working with two-dimensional rrays What operations will you code? Matrix Addition -1 0 41 0 4 7 5 1 91 7 6 16 Matrix Subtraction 1 4 31 -1 0 41 2 4-1 2 5 7]L5 1 9 3 4-2 Matrix Multiplication (Extra Credit) 7 16 16 33 Approach: You will use an ADT to represent a matrix and store the values of it. Your main program will prompt for a file that contains the dimensions of the matrix and the numerical values each row on a line and each value separated by a space. Your ADT will read the matrix from file using the ReadMatrix function. This function will read first the dimensions of the matrix: m, n. Then it will proceed to read m*n values from the file. After reading the first matrix, it will read the second matrix the same way. Note that these two matrices may not have the same dimensions. After reading the operands, the file contains in a single line a single character indicating the operation (+, -, *), your program will read it. Finally, the program will use again the ReadMatrix function to read the "supposedly" result of operating the first two matrices. At the end of reading the file, your program will have in memory three matrices and one character indicating the operation. The program then will check if the third matrix has the correct values for the operation, if it does, then it will output a message indicating that the values are correct, if not it will indicate that the result is incorrect. At the end of this document, there is a sample run of the main program. Input File Format The input file format description (look at picture): First line: contains two integer (m, n) numbers that represent the dimension of the following matrix. (First operand) Next m lines: contain n numbers each that represent the values for each position of the matrix. Next line: contains two integer (m, n') numbers that represent the dimension of the following matrix. (Second operand) Next m lines: contain n numbers each that represent the values for each position of the matrix Next line: a single character (+, -, or *) that represents the operation to do Next line: contains two integer (m", n") numbers that represent the dimension of the following matrix. (Result) Next m" lines: contain n" numbers each that represent the values for each position of the matrix

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!