// rational-overload-driver.cc // driver for RationalNumber class // problem 8.17 in D&D #include "rational-overload.h" main() { RationalNumber c(7,3), d(3,9), x; cout << c << " + " << d << " = "; x = c + d; cout << x << endl; cout << c << " - " << d << " = "; x = c - d; cout << x << endl; cout << c << " * " << d << " = "; x = c * d; cout << x << endl; cout << c << " / " << d << " = "; x = c / d; cout << x << endl; cout << c << " is: " << endl; cout << ((c > d) ? " > " : " <= ") << d << " according to the overloaded > operator" << endl; cout << ((c < d) ? " < " : " >= ") << d << " according to the overloaded < operator" << endl; cout << ((c >= d) ? " >= " : " < ") << d << " according to the overloaded >= operator" << endl; cout << ((c <= d) ? " <= " : " > ") << d << " according to the overloaded <= operator" << endl; cout << ((c == d) ? " == " : " != ") << d << " according to the overloaded == operator" << endl; cout << ((c != d) ? " != " : " == ") << d << " according to the overloaded != operator" << endl; cout << "Input a RationalNumer num/denom: "; cin >> x; cout << x; cout << endl; return 0; }