/*
   Represent matrices.  Demo of 2D arrays and initialization. See Nyhoff 457-462 and Chapter 13.
   
   1) What happens and why?
   
   2) Write code to output the matrix in a proper way.
   
   3) Write a function that calculates the matrix product.
   
   4) Write a function that calculates the Trace and Determinant of a 3x3 matrix.
   
   5) Write a function that calculates the characteristic polynomium. 
   
   6) Consider a[column][row] or a[row][column]
*/

#include <iostream>
using namespace std;

// Very ugly global constant.
const int DIM=3;

// Functions needs to know the dimensions of the array dimensions.
void Print(double a[DIM][DIM], int size)
{
// write code to print the array here.
   cout << a[0][0] << endl; 
}

int main()
{

   double I[DIM][DIM] = { {1.0 , 0.0, 0.0},
                          {0.0 , 1.0, 0.0},
                          {0.0 , 0.0, 1.0}   };
   
   
   double M[DIM][DIM] = { {1.0 , 2.0, 4.0},
                          {0.0 ,-1.0,-2.0},
                          {1.0 , 1.0, 1.0}  };
   
   cout << M << endl;   // Whoa? 

   Print(M,DIM);

   return 0;
}
