Well, generally you'll want to actually post the code you're having problems with.
That's what I was afraid of. I was hoping someone had experienced this before and could give a quick answer. Well, here it goes.
It is part of a matrix class I am trying to make. One of the functions I am having problems with is one which multiplies a row by a number.
Code:
void Matrix::MultiplyRow(int Row,double Factor)
{
for(int u=1;u<=j;u++) {
ChangeElement(Row,u,Factor*GetElement(Row,u));
}
}
It works fine most of the time but fails if I try something like this:
matrix.MultiplyRow(1,1.0/b.GetElement(1,1));
I can display the denominator like this:
std::cout<<b.GetElement(1,1);
but this doesn't work:
std::cout<<1.0/b.GetElement(1,1);
Here are the ChangeElement() and GetElement() functions:
Code:
double GetElement(int row,int column)
{
return thematrix[column-1][row-1];
}
void ChangeElement(int row,int column,double value)
{
thematrix[column-1][row-1]=value;
}
Thanks,
hunterdude