Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve it using visual studio builder C++. PLEASE DO NOT FORGET TO FOLLOW THE INSTRUCTION FOR THE PROGRAM. EVERY COUT STATEMENT SHOULD BE PRINTED
please solve it using visual studio builder C++. PLEASE DO NOT FORGET TO FOLLOW THE INSTRUCTION FOR THE PROGRAM. EVERY COUT STATEMENT SHOULD BE PRINTED AS GIVEN. THANK YOU
Many mathematical problems require the addition, subtraction, and multiplication of two matrices Write an ADT Matrik. You may use the followine class defirition. const int MAXROWS=10; const int MAX_COLS=10; class Matrixitybe. I public Matristype(): woid Setsizefint rowsize, int colsize); void storeitem(int atem, int row, int cod): void Add[Matrixtype otherOperand, Matristypes reudt). void Sub(Matrixfype otherOperand, Matrixtypes result). void Mult(Matraxivpe otherOperand, MatrixTypes result); void Printly bool AddsubCompatible(MatrixType otherOperand). bool Mukcompatible(Matrixtype ctheroperand). private: int values [MAX ROWS][MAX COLS]- int numpows; int numcols: Ewefy ingtentintion of Matrixtype will give you d new matrix, initialy, in the constructor, both- the: number of rows and the number of columrs are set to 0 . This indicates that an empty mafrix is created. Then, the user is asked to provide the number of rows, the number of columns, and the value for each combination of row and colimin. To represent the matrices, you need to consider an array [Matrix[10]] of MatrixTypet initiol y, the lengeh of this array. Nutrberothatrices, is =0. The index of the array can be Every imatantiation of Matriathpe will give voe a new matro. intitly, in the constructor, both the number of rewn and the number of columns are set to a. This indicater that an empty matria in creved. Ther, the user in asked to provide the number of rows, the manber of colians, and the value for eash. combenation of rew and column. To repersent the matrices, you need to coneliker an array (Matriaf 10 ]) of Matriatipe initialy, the lonuth of tha arrov, NumberofMatrices, as =0. The irdex of the artay can be 0 to 9, i. , there can le at mont 10 matrices at mo even time. Note that the das provides two member furetions, Addsubcompatble and Mullempatele, to allow the uner to determiere if the binary matria copratom faldtive, vuteraction, and matilicationj are condide for example, addrec a matois of sue 34 with another matric 3x7 is inteasible. You heed to theck wuch neceicary precondeions for each operabion t an eperation it not posnible. vou thosld weovide apbropriate endr ifestatn to vier. An ekanple of outpuit teter the correspondre number for vour desired opernticni 1 - sot a new matric, 2-add two mabrices. 3 - subtiact a matrix from another, 4 - multiply two matricesi 5 - priet matris 6 - end the procram 1. A matcox with ore is crested- Eener the number of rows and the number of columins far that neiw natrix 4 Enter the ralues: Enter the corresponding number for your desired operation: 1 - get a new matrix; 2-add two matrices; 3 - subtract a matrix from another: 4 - multiply two matrices; 5 - print matrix; 6 -end the program. 1 A matrix with 0x0 is created. Enter the number of rows and the number of column for this new matrix: 3. 4. Enter the values 4793 167519 10099317 Thank you. You now have total 1 matrices in system. Enter the corresponding number for your deslred operation: 1 - get a new matric: 2 - add two matrices: 3 - subtract a matrix from another; 4 - multiply two matrices: 5 - print matrix; 6 - end the program 5. Enter the matrixnumber for printing: 1. The input ls invalid. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices; 3 - subtract a matrix from another; 4 - multiply two matrices; 5 - print matrix; 6 - end the program 5 Enter the matrix number for printing: 0 4793 167519 10099317 Inter the corresponding nember for vour deaired operation: 1 - get a new matrik: 2 - add two matrices. 3 - subtract a matrik from another: 4 - multiply two matrices: 5 - pint matrix; 6 - end the proeram 2 Sunpose that you want to perform C-A.B. Enter A,B and C 013 The operation is not compatible. Enter the corresponding number for your desired operationa 1 - get a nww matric; 2 - add two matrices 3 - subtract a matrix from anothes: 4 - multiply two matrices 5 - peint matric 6 - end the program 1 A matrix with 00 is cieated. Enter the number of rown and the namber of columes for this new matrix: 4. 3 Enter the values: 9171523112512719171612 Thank you: You now have total 2 matrices in system, Enter the corresponding bumber for your deslifed operation: 1 - get a new matric: 2 -odd two miatuiceek: 231125 12711) 17.161? Thank vou. You now have total 2 matrices in system. Enter the couresponding nuenber for your desired operation: 1 - Eut a new matrixi 2 -add fwo matrices: 1- subtract a matrik fiom another 4 - mudtioly two matikes 5 - pint matike 6 -end the pcoseram 1 A matrix with 00b created, Enter the number ot rown and the number of colunns: (i) Enter the values: 719136 5275117 10 132015 Thank you. You now have total 3 matrices in system. Enter the corresponding number for your desired operation: 1 - get a new matrib 2 - add two matrices 3 - subtract a matrix from another; 4 - multiply two matrices: 5 -print matric; 6 - end the program. 1 A matrix with 00 is created. Enter the number of rows and the number of columns: 3 4 Enter the values: Enter the values: 1719136 5312710 181032205 Thank you. You now have total 4 matrices in system. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices; 3 - subtract a matrix from another; 4-multiply two matrices; 5-print matrix; 6 - end the program 2 Suppose that you want to perform C=A+B. Enter A,B and C : 023 Matrices 0 and 2 are added and the result is stored in matrix 3 . Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices; 3 - subtract a matrix from another; 4-multiply two matrices; 5-print matrix; 6 - end the program Fnter the corresponding number for your desired operation: 1 - bet a new matrix; 2 - add two matrices 3-subtract a matrix from another; 4-multiply two matrices;5 - print matrix; 6-end the program 5 Enter the matrix number for printing: 3 The matrix 3 is: 1126229 6845636 1101122332 Enter the corresponding number for your desired operation: 1 - 8 et a new matrix; 2 -add two matrices; 3 - subtract a matrix from another; 4 - multiply two matrices; 5 - print matrix; 6 - end the program 3 Suppose that you want to perform C=AB. Enter A,B and C : 032 Matrix 3 is subtracted from matrix 0 , and the result is stored in matrix 2. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2-add two matrices; 3 - subtract a matrix from another; 4 - multiply two matrices; 5 - print matrix; 6-end the program 4 Suppose that you want to perform C=AB. Enter A,B and C. 031 The operation is not compatible. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2-add two matrices; 3 - subtract a matrix from another; 4-multiply two matrices; 5-print matrix; 6-end the program 1 A matrix with 0X0 is created. Enter the number of rows and the number of columns: 3 3 141712 176 0298 Thank you. You now have total 5 matrices in system. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices; 3 - subtract a matrix from another; 4 -multiply two matrices; 5 -print matrix; 6 -end the program Suppose that you want to perform C=AB. Enter A, B and C. 031 The operation is not compatible. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 -add two matrices; 3 - subtract a matrix from another: 4 - multiply two matrices; 5 - print matrix; 6-end the program 1 A matrix with 00 is created, Enter the number of rows and the number of columnis: 3 3 Enter the valoes: 141712 176 0298 Thank you, You now have total 5 matrices in system. Eriter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices; 3 - subtract a matrix from another; 4 - multiply two matrices: 5 - print matrix; 6 - end the prosram Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started