Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

//**************************************

//     

//INCLUDE files for :Matrix Multiplicati

//     on

//**************************************

//     

#include 

 

code:

Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!

 

Terms of Agreement:   

By using this code, you agree to the following terms...   

1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   

2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   

3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 

4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.  

//     

#include 

int main()

    {

    int cols = 3, rows= 2, colss= 2, rowss= 3;

    int var = 0;

    cout << "Enter in the number or rows for the first matrix: ";

    cin >> cols;

    cout << "Enter in the number or columns for the first matrix: ";

    cin >> rows;

     int mat[2][2];

     mat[rows-1][cols-1];

     for(int row = 0; row <= rows-1; row++)

         {

         for(int col = 0; col <= cols-1; col++)

             {

             cout << "Enter the value for the element of row " << row + 1 << " and column " << col + 1 << " of the first matrix: ";

             cin >> var;

             mat[row][col] = var;

             cout << '\n';

             }

             }

            cout << "Enter in the number or rows for the second matrix: ";

            cin >> colss;

            cout << "Enter in the number or columns for the second matrix: ";

            cin >> rowss;

             int matr[2][2];

             matr[rowss-1][colss-1];

             for(row = 0; row <= rowss-1; row++)

                 {

                 for(int col = 0; col <= colss-1; col++)

                     {

                     cout << "Enter the value for the element of row " << row + 1<< " and column " << col + 1<< " of the second matrix: ";

                     cin >> var;

                     matr[row][col] = var;

                     cout << '\n';

                     }

                     }

                    int matri[2][2];

                    matri[rows][rowss];

                    matri[1][0] = 0;

                    int vect[2];

                    for(int xvar = 0; xvar <= rows; xvar++)

                         {

                         for(int yvar = 0; yvar <= cols; yvar++)

                             {

                             for(int xvari = 0; xvari <= rowss; xvari++)

                                 {

                                 for(int yvari = 0; yvari <= colss; yvari++)

                                     {

                                     vect[yvar] = mat[xvar][yvar] * matr[yvari][xvari];

                                     }

                                     }

                                     }

                                     for(int vecto = 0; vecto <= rows; vecto++)

                                         {

                                         for(int xvect = 0; xvect <= rows; xvect++)

                                             {

                                             for(int yvect = 0; yvect <= rows; yvect++)

                                                 {

                                                 matri[xvect][yvect] = vect[vecto];

                                                 }

                                                 }

                                                 }

                                                

                                                 } 

                                                

                                                 cout << "\n";

                                                 for (rows = 0; rows < 2; rows++)

                                                     {

                                                     for (cols = 0; cols < 2; cols++)

                                                         {

                                                         cout << matri[rows][cols] << " ";

                                                         }

                                                         cout << endl;

                                                         }

                                                        return 0;

                                                    }