Ejemplo n.º 1
0
Rational operator^(Rational num1, int power)
{
    int c = pow(num1.getB(), power);
    int d = pow(num1.getA(), power);
    return Rational(d, c);
}
Ejemplo n.º 2
0
Rational operator*(Rational num1, Rational num2)
{
    int c = num1.getB() * num2.getB();
    int d = num1.getA() * num2.getA();
    return Rational(d, c);
}
Ejemplo n.º 3
0
Rational operator-(Rational num1, Rational num2)
{
    int c = LCM(num1.getB(), num2.getB());
    int d = (c / num1.getB())*num1.getA() - (c / num2.getB())*num2.getA();
    return Rational(d, c);
}
Ejemplo n.º 4
0
Rational operator*(int num2, Rational num1)
{
    int c = num1.getB();
    int d = num2*num1.getA();
    return Rational(d, c);
}
Ejemplo n.º 5
0
bool operator>(Rational rat, int num)
{
    Rational temp = rat - num;
    if (temp.getA() > 0) return true;
    else return false;
}
Ejemplo n.º 6
0
Rational operator-(Rational num1, int num2)
{
    int c = num1.getB();
    int d = num1.getA() - num2*num1.getB();
    return Rational(d, c);
}