You don't need new class. A function which works with your matrix class.
Matrix pow(Matrix m, unsigned int n);
And as I said before, this should work just like a function which raises an int to an (unsigned) int power.
But I can see issues with your code:
1. you're trying to read m2 from infilOne (after closing it!) rather than infilTwo
2. you're trying to return a matrix variable from main
(the second means your code won't even compile!)
The list of powers I posted above was created using your code after:
1. I got rid of m2 and its associated file
2. I got rid of the broken return
3. I added code which used your operator* to multiply the matrix (using a while loop), starting off with a unit matrix of the right size.
4. I also had to fix the constructors and add methods to set and get elements to I could set a matrix to the required values for it to be a unit matrix. Plus methods to get the size of the input matrix.
Andy
@ Albo Coder
See: Matrix multiplication
http://en.wikipedia.org/wiki/Matrix_multiplication