CECS 282
LAB ASSIGNMENT
Assigned date: 10/1
Due date: Tue 10/8
30 points
Do the matrix operations (add, sub, multiplication) discussed in the class on Tuesday, October 1.
The class Matrix should have the following members, constructor, destructors, and functions:
class Matrix
{
private:
int rowSize;
int colSize;
int ** ptr;
public:
Matrix(int rowSize, int colSize);
~Matrix();
void add (const Matrix &second, Matrix &result) const;
void subtract (const Matrix &second, Matrix &result) const;
void multiply (const Matrix &second, Matrix &result) const;
void input( ) const;//input the matrix from the keyboard
void print() const; //display matrix to the console window
};
Write a function to test all the public constructor and methods in the main.
Input two matrices:
Matrix 1
3 2 3 1
4
4 5 1
4 4 1 5
Matrix 2
4 3 1 3
3
5 1 5
4 5 1 4
Matrix 3
4 1
5 5
3 4
2
1
Use matrix 1 and matrix 2 for addition and subtraction
Use matrix 1 and matrix 3 for multiplication
Grading
Inside the program, put your name at the beginning of your program
//YOUR NAME
// CECS 282 LAB 5