      1  #include "matrix4.h"
      2
      3  using std::cout;
      4  namespace mat = BigCPlusPlus_Matrix;
      5
      6  int main()
      7  {
      8     mat::Matrix m(3, 3);
      9     m[0][0] = m[1][1] = m[2][2] = 1;
     10     m[0][1] = m[1][2] = 2;
     11     cout << 2 * m << "\n";
     12     cout << m * m << "\n";
     13     cout << 2 * m + m * m;
     14     try
     15     {
     16        m[4][2] = 7; // Purposeful subscript error
     17     }
     18     catch (mat::Matrix::IndexException& e)
     19     {
     20        cout << "Caught exception: " << e.what() << "\n";
     21     }
     22     return 0;
     23  }