Hello . Who among you knows the C ++ code for these steps | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello . Who among you knows the C ++ code for these steps

Hello . Who among you knows the C ++ code for these steps , the user chooses one of the operations below and then enters (one or two) matrices of order 3*3 and stores it in two-dimensional array. Then, the program displays the result on the screen. Matrix Operations 1. Matrix Multiplication. The product of two matrices 2. Matrix Addition. The sum of two matrices 3. Matrix Subtraction. 4. Matrix Inversion 5. The Transpose of a Matrix

18th Nov 2020, 4:46 PM
yous
yous - avatar
5 Answers
+ 3
You can use an if-statement or a switch-statement for the menu. Multiplication can be done with three nested loops, one that iterates over the rows, one that iterates over the column, and one to calculate the cartesian product of the current row of the left matrix and the current column of the second matrix. Addition and Subtraction can be done via two nested loops, one for the row and one for the column, where you simply add or subtract each element. The inverse is probably the hardest operation, it is typically implemented with the help of the determinant and minors/cofactors, you'll likely have to look that up. The transpose is fairly easy, just iterate over the matrix as before and switch the row and column of the elements. You could use the following lessons as reference: https://www.sololearn.com/learn/740/?ref=app https://www.sololearn.com/learn/742/?ref=app https://www.sololearn.com/learn/743/?ref=app
18th Nov 2020, 5:03 PM
Shadow
Shadow - avatar
+ 5
Ah, you are not using the app then. Well, you can find reference programs on the web fairly simple by just looking up C++ + matrix <operation>. For example: Multiplication: https://www.tutorialspoint.com/cplusplus-program-to-perform-matrix-multiplication Addition: https://www.tutorialspoint.com/cplusplus-program-to-add-two-matrix-using-multi-dimensional-arrays Transpose: https://www.tutorialspoint.com/cplusplus-program-to-find-transpose-of-a-matrix You could also try searching the SoloLearn playground by similar means. There are a lot of possibilities.
18th Nov 2020, 5:38 PM
Shadow
Shadow - avatar
+ 2
Please don't expect to be spoon fed. The links work (at least in the app, didn't think about web version) and Shadow gave a you a really detailed answer. You should be able to make an attempt and if you get stuck you can post it and ask for help on the specific problem
18th Nov 2020, 5:43 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
- 1
The link does not work. I'd like another way. Thank you
18th Nov 2020, 5:11 PM
yous
yous - avatar
- 1
I want to write the code, I need help 💔🥺.
18th Nov 2020, 6:38 PM
yous
yous - avatar