samedi 14 mars 2020

explain Multiplication two matrix in c++

I want a detailed explanation of why we used three loop and also why we used index k in the multiplication code
i try to understand it but i cant

for(int i=0;i<r1;i++)
        {
            for(int j=0;j<c2;j++)
            {
                c[i][j]=0;
                for(int k=0;k<c1;k++)
                    c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
            cout<<"c["<<i<<"]["<<j<<"]="<<c[i][j]<<endl;
    }}```

Aucun commentaire:

Enregistrer un commentaire