Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please update the code below: Create a text file which to transfer all selection from main(), like input, output and result to the text file

Please update the code below: Create a text file which to transfer all selection from main(), like input, output and result to the text file after run and end the program.

#include #include using namespace std;

const int MAX_ROWS = 10; const int MAX_COLS = 10;

class MatrixType { public: MatrixType(); void MakeEmpty(); void SetSize(int rowsSize, int colSize); void StoreItem(int item, int row, int col); void Add(MatrixType otherOperand, MatrixType& result); void Sub(MatrixType otherOperand, MatrixType& result); void Mult(MatrixType otherOperand, MatrixType& result); void Print(ostream& outfile); bool AddSubCompatible(MatrixType otherOperand); bool MultCompatible(MatrixType otherOperand); private: int values[MAX_ROWS][MAX_COLS]; int numRows; int numCols; }; MatrixType::MatrixType() { numRows = numCols = 0; } void MatrixType::MakeEmpty() { for(int i = 0; i = 1 && c >= 1) { numRows = r; numCols = c; } else cout = 0 && c = 0) values[r][c] = item; else cout

void new_matrix(int i, MatrixType * matrices, bool * add) { int r, c, temp; cout > r >> c; if(r > 0 && r 0 && c > temp; matrices[i].StoreItem(temp, j, k); } } matrices[i].Print(cout); } else cout = 0 && i > v; if(v > i; if(v > 0 && v > j >> k; if( i == j || j == k || i == k) { cout

Here is a sample run of the program:

image text in transcribed

O X C:\Users\Erickson\Documents\Visual Studio 2015\Projects\MatrixTy... - Choice and parameters: O New Matrix Usage: 0 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3 Multiply Matrices Usage: 3 4. Print Matrices Usage: 4 5 Quit Usage: 5 matris material Enter Choice and Parameters: 0 0 Creating new matrix in slot 0. Enter row and column size: 3 3 Row 0: 1 2 3 Row 1: 4 5 6 Row 2: 7 8 9 [ 1 2 3 ] | 4 5 6 1 [ 7 8 9 ] Choice and parameters: O New Matrix Usage: 0 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3. Multiply Matrices Usage: 3 4 Print Matrices Usage: 4 5 Quit Usage: 5 Enter Choice and Parameters: . O X C:\Users\Erickson\Documents\Visual Studio 2015\Projects\MatrixTy... - Choice and parameters: O New Matrix Usage: 0 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3 Multiply Matrices Usage: 3 4. Print Matrices Usage: 4 5 Quit Usage: 5 matris material Enter Choice and Parameters: 0 0 Creating new matrix in slot 0. Enter row and column size: 3 3 Row 0: 1 2 3 Row 1: 4 5 6 Row 2: 7 8 9 [ 1 2 3 ] | 4 5 6 1 [ 7 8 9 ] Choice and parameters: O New Matrix Usage: 0 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3. Multiply Matrices Usage: 3 4 Print Matrices Usage: 4 5 Quit Usage: 5 Enter Choice and Parameters

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

More Books

Students also viewed these Databases questions