Hi, I'm trying to build a very simple matrix class using vectors (I know this is not ideal!).
I just want to get to the stage where I can create a matrix of zeros as
in a source file. At the moment I'm getting an error for the line:
saying error C2143: syntax error : missing ';' before '<'
Please help!
Code:
#include<vector>
class matrix
{
vector <vector <double> > mat;
unsigned rows,cols;
public:
//constructor
Matrix(unsigned rows_,unsigned cols_)
{
rows=rows_;
cols=cols_;
vector <double> vector1;
for(int i=0;i<rows_;i++)
{
vector1.push_back(0.0);
i++
};
mat.push_back(vector1);
vector <double> vector2;
for(int j=0;i<cols_;j++)
{
vector2.push_back(0.0);
j++
};
mat.push_back(vector2);
};
//destructor
~Matrix();
}
I just want to get to the stage where I can create a matrix of zeros as
Code:
matrix(3,2)
Code:
vector <vector <double> > mat;
Please help!
Last edited: