Exemplo n.º 1
0
const Fraction operator*(const Fraction& term1, const Fraction& term2) {
	//Turned into improper fractions and then mulitplied through
	Fraction result;
	result.SetNumerator(((term1.GetWhole() * term1.GetDenominator()) + term1.GetNumerator()) * ((term2.GetWhole() * term2.GetDenominator()) + term2.GetNumerator()));
	result.SetDenominator(term1.GetDenominator() * term2.GetDenominator());
	result.Normalize();
	
	return result;
}
Exemplo n.º 2
0
const Fraction operator/(const Fraction& term1, const Fraction& term2) {
	//Multiplies by the reciprocal of term2
	Fraction result;
	result.SetNumerator(((term1.GetWhole() * term1.GetDenominator()) + term1.GetNumerator()) * term2.GetDenominator());
	result.SetDenominator(term1.GetDenominator() * ((term2.GetWhole() * term2.GetDenominator()) + term2.GetNumerator()));
	result.Normalize();
	
	return result;
}