// File: main1.C // // Testing the fraction class #include #include "fraction.h" main() { Fraction f1, f2, f3 ; f1 = Fraction(1, 2) ; f2 = Fraction(7, 8) ; cout << "Original values:\n" ; cout << "f1: " ; f1.display() ; cout << "\n" ; cout << "f2: " << f2 << "\n" ; cout << "\nAddition\n" ; f3 = f1 + f2 ; cout << "f3: " << f3 << "\n" ; cout << "\nSubtraction\n" ; f3 = f1 - f2 ; cout << "f3: " << f3 << "\n" ; cout << "\nMultiplication\n" ; f3 = f1 * f2 ; cout << "f3: " << f3 << "\n" ; cout << "\nDivision\n" ; f3 = f1 / f2 ; cout << "f3: " << f3 << "\n" ; cout << "\nPrecedence\n" ; f3 = f1 + f2 * f1 ; cout << "f3: " << f3 << "\n" ; cout << "\nAssociativity\n" ; f3 = f2 - f1 - f1 ; cout << "f3: " << f3 << "\n" ; }