# Thread: my gaussian elimination problem

1. ## my gaussian elimination problem

Code:
```Fraction arr[10][11];

if (arr[i][i] == 0)```
that part of my code doesn't work...after i is initialized. I'm just wondering why.

these are two of my methods in my class Fraction
Code:
```void div( Fraction divisor )
{
numerator   *= divisor.denominator;
denominator *= divisor.numerator;
}

void mult( Fraction multiplier)
{
numerator /= multiplier.denominator;
denominator /= multiplier.numerator;
}```
in the int main of that program,
fraction arr[10][11] and int i, j, and k are initialized.

i've been trying to send arrays to the class to return it as a fraction. but im not sure if im doing this right.

Code:
```  if (arr[i][i] != 0) // this line returns an error
{
Fraction divisor = arr[i][i];

for (int k=0; k < (N+1); k++)
{
arr[i][k].div(divisor);
}
}

for (int j=0; j<N; j++) // for each row
{
if (j !=i)
{
Fraction multiplier = arr[j][i];
for (int k=0; k<(N+1); k++)
arr[j][k].mult(multiplier) -= arr[i][k].mult(multiplier);```
ok i didn't put that much code in this time..i hope someone can help. im not really sure if im getting somewhere with this right now. i've looked everywhere in my book..and i can't find it..but if its in there and i just can't see it..i just sure as hell don't understand it.

2. arr[i][i] is of type Fraction, why are you comparing it with the integer 0?
May not be apples and oranges to you, but it is to the compiler.

gg

3. ## i understand that

i knew that from the beginning..but how do i with the lack of a better term convert Fraction arr[i][i] to int?

4. One way:
Code:
```bool Fraction::is_zero()
{
return (numerator == 0);
}```
Or you could overload the "!=" operator.

gg