Comp 2673
Homework 5
Due Tuesday, May 27, 2003

Below is a link to a c++ sourcefile. This sourcefile contains incomplete code for a class that stores matrices as well as a test program for the class. Your job for this homework is to complete the code for the class, compile it, run it, test it, debug it.

Matrix.cpp

In this source file, you'll find notes in several locations indicating what code must be written. You'll need to add prototypes of member functions in the class definition, you'll need to implement every function in the class, and you'll need to add an overloaded stream insertion operator.

The test program does not need to be altered. If you choose, you may add code to it to make a more complete test. However, do not remove any code from it.

Here's sample output from the test program:

ftl@evans> matrixtest 
Matrix m1, Matrix m2, and Matrix m3: 
   0    1    2    3 
   4    5    6    7 
   8    9   10   11 

   0    1    2    3 
   4    5    6    7 
   8    9   10   11 

   0    1    2    3 
   4    5    6    7 
   8    9   10   11 

Enter the number of rows and columns in your matrix: 2 3
Enter 6 values for the contents of the array: 3.4 5 10 12.1 5 19
This is your matrix: 
 3.4    5   10 
12.1    5   19 

Matrix object passed to a function: 
 3.4    5   10 
12.1    5   19 

Email the completed source code on or before the due date to comp2673@cs.du.edu. Also turn in a hard copy. As usual for homework this quarter, you may work with one other person. However, you should collaborate in the following way. You and your partner should individually solve the assignment, then collaborate by comparing your solutions and correcting each other's errors. If you collaborate, make sure both names are included in the source code.