0

I'm recently doing an assignment for fraction problem. I've implemented classes for the programme to accept fractions. And i've overloaded operator +, -, *, / and ==...

But here is some strange thing.

Before that i show some of my code here regarding operator -:

```
Fraction operator-( Fraction a, Fraction b )
{
Fraction result;
result.numerator = a.numerator * b.denominator - b.numerator * a.denominator;
result.denominator = a.denominator * b.denominator;
result.simplify();
return result;
}
```

The code is simple, it will minus directly with 2 fraction which is fraction a and b.

but here is a strange thing:

2/5 - 1/2 = 1/-10

actually it will have user to cin the answer, if i gv the answer -1/10 the bool will have to check but fortunately the compiler is clever enough knowing that 1/-10 == -1/10

but sometimes if the user put wrong answer and i would like the program to show the correct answer, but not 1/-10, i want it to show -1/10

is there anything i should modify?

Thx