0

I am getting this error when I compile. I have tried taking Add out the code, but I do not get an output then. How can I fix this to produce an output??

```
//This program serves as a test for the Matrix class
#include <iostream>
#include "Matrix.h"
using namespace std;
int main (int argc, char * const argv[])
{
Matrix mat1;
Matrix mat2;
int rows;
int cols;
int initValue;
cout << "Please enter the number of Rows: " << "\n";
cin >> rows;
cout << "Please enter the number of Columns: " << "\n";
cin >> cols;
cout << "Enter the initial value for the Matrix: " << "\n";
cin >> initValue;
Matrix(rows, cols, initValue);
for(int i=0; i < rows; i++)
for(int j=0; j < cols; j++)
Add(mat1, mat2);
for(int i=0; i < rows; i++)
for(int j=0; j < cols; j++)
Multiply(mat1, mat2);
return 0;
}
```

```
/*
* Matrix.h
* Matrix
*
* Created by Dawn Ellis on 8/14/09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
#include <vector>
using namespace std;
class Matrix
{
private:
int numberOfRows;
int numberOfColumns;
vector<vector<int>> mat;
public:
/* Default constructor
Creates a 1x1 matrix that contains 0 */
Matrix();
/* Parameterized constructor
Create a matrix of the specified size with all cells set to the
initial value.
Inputs: three integer values, the first two represent the number
of rows and columns in the matrix, and the third integer
represents the initial value of the matrix cells. */
Matrix(int rows, int cols, int initValue);
/* Implements matrix addition.
Inputs: A matrix to add to the current matrix
Outputs: A new matrix which is the result of adding two matrices together */
void Add(vector<vector<int> >mat1, vector<vector<int> >mat2);
/* Implements matrix subtraction.
Inputs: the matrix to multiply from the current matrix.
Outputs: A new matrix which is the result of the difference between the
two matrices. */
void Multiply(vector<vector<int> >mat1, vector<vector<int> >mat2);
};
#endif
```

```
#include <iostream>
#include "Matrix.h"
using namespace std;
Matrix::Matrix()
{
int numberOfRows = 1;
int numberOfColumns = 1;
vector<int> mat(numberOfRows, 0);
vector<vector<int> > mat2d1(numberOfColumns,mat);
for(int i=0; i < mat2d1.size(); i++)
for (int j=0; j < mat2d1[i].size(); j++)
cout << mat2d1[i][j] << " "; cout << endl;
}
Matrix::Matrix(int rows, int cols, int initValue)
{
int numberOfRows = rows;
int numberOfColumns = cols;
vector<int> mat(numberOfRows, initValue);
vector<vector<int> > mat2d1(numberOfColumns,mat);
for(int i=0; i < mat2d1.size(); i++)
for (int j=0; j < mat2d1[i].size(); j++)
cout << mat2d1[i][j] << " " << endl;
}
void Matrix::Add(vector<vector<int> >mat1, vector<vector<int> >mat2)
{
for (int i=0; i < numberOfRows; i++)
{
for (int j=0; j < numberOfColumns; j++)
mat1[i][j]+=mat2[i][j];}
for (int i=0; i < numberOfRows; i++)
{
for (int j=0; j < numberOfColumns; j++)
cout << mat1[i][j];}
}
void Matrix::Multiply(vector<vector<int> >mat1, vector<vector<int> >mat2)
{
for (int i=0; i < numberOfRows; i++)
{
for (int j=0; j < numberOfColumns; j++)
mat1[i][j]*=mat2[i][j];}
for (int i=0; i < numberOfRows; i++)
{
for (int j=0; j < numberOfColumns; j++)
cout << mat1[i][j];}
}
```