const int SIZE=6; class matrix { private: int col; int row; double e[SIZE][SIZE]; public: // Constructors matrix (); // Sets every element to zero along with the dimensions matrix (int, int, double[SIZE][SIZE]); // initialize constructor matrix (const matrix&); // Member functions void input (); void output (); void identity(const int&); // creates an n x n identity matrix matrix s_mult(const double&); // Multiplies the calling object by "double" matrix add(const matrix&); matrix subtract(const matrix&); matrix multiply(const matrix&); matrix augment(const matrix&); matrix inverse (); void findpivot(matrix&, int); void rowdivide(const int&, double, matrix&); void copy (matrix&); void revcopy (matrix&); double det(); matrix minor(int, int); // Overloaded Operators }; // Constructors // Default Constructor matrix::matrix () { row = 0; col = 0; for (int j=0; j < SIZE; j++) { for (int i=0; i < SIZE; i++) e[j][i]=0; } } // end default constructor // end initialize constructor matrix::matrix (int a, int b, double x[SIZE][SIZE]) { row = a; col = b; for (int i=0, j = 0; j < b; i++) { e[j][i]=x[j][i]; if (i/(a-1)==1) { j++; i=0; } } } // end initialize constructor // copy constructor matrix::matrix (const matrix& m) { row = m.row; col = m.col; for (int i = 0; i < row; i++) { for (int j=0; j < col; j++) e[i][j]=m.e[i][j]; } }// end copy constructor void matrix::input () { int x, y; char ans; do { cout << "\n\nMatrix Size: x "; x=wherex(); y=wherey(); gotoxy(x-5,y); cin >> row; gotoxy(x-1,y); cin >> col; cout << "[ "; for (int j=0; j> e[j][i]; gotoxy(x+5,y); } if (j> ans; } while ((ans=='y')||(ans=='Y')); } // end input function // output function void matrix::output () { int x, y; cout << "[ "; for (int i=0; i < row; i++) { for (int j=0; j < col; j++) { x = wherex(); y = wherey(); cout << e[i][j]; gotoxy (x+7, y); } if (i < row -1) cout << "\n "; } cout << ']' << '\n'; } // creates n x n identity matrix void matrix::identity(const int& n) { row = n; col = n; for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { if (j==i) e[i][j]=1; else e[i][j]=0; } } } // does scaler multiplication matrix matrix::s_mult(const double& x) { matrix m; m.row = row; m.col = col; for (int i = 0; i < row; i++) { for (int j=0; j < col; j++) m.e[i][j] = e[i][j]*x; } return m; } // adds two matricies as long as their dimensions are the same matrix matrix::add(const matrix& m) { matrix x; if ((m.row==row)&&(m.col==col)) { x.row = row; x.col = col; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) x.e[i][j]=e[i][j]+m.e[i][j]; } } // end if statement return x; } matrix matrix::subtract(const matrix& m) { matrix x; if ((m.row==row)&&(m.col==col)) { x.row = row; x.col = col; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) x.e[i][j]=e[i][j]-m.e[i][j]; } } // end if statement return x; } matrix matrix::multiply(const matrix& m) { matrix x; if (col==m.row) { x.col=m.col; x.row=row; for (int i = 0; i < x.row; i++) { for (int j = 0; j < x.col; j++) { for (int z = 0; z < col; z++) x.e[i][j] += e[i][z] * m.e[z][j]; } } } // end if statement return x; } // end multiply function // augment matrix function that serves no real purpose // go random assignments matrix matrix::augment(const matrix& m) { matrix x; int i, j, l; if (row == m.row) { x.row = row; x.col = col + m.col; for (i=0; i