Matrices on c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Matrices on c++

How do I add two 2 by 2 matrices using for loops and even transform them?

23rd Oct 2019, 7:58 PM
Martin Mbugua
3 Answers
+ 3
You just iterate through the matrices(m1,m2) and store the sum in the new matrix sum for(int i=0;i<2;i++){ for(int j=0;j<2;j++){ sum[i][j]=m1[i][j]+m2[i][j]; cout<<sum[i][j]<<“ “; } }
23rd Oct 2019, 9:53 PM
Andreea Gînga
Andreea Gînga - avatar
0
int matrice[2][2] = blah blah blah
23rd Oct 2019, 8:05 PM
OnesAndZeroes10
OnesAndZeroes10 - avatar
0
I have a code for multiplying matrices in c#. Take a look in my profile, it will help you.
23rd Oct 2019, 9:52 PM
Rodrigo Oliveira
Rodrigo Oliveira - avatar