//**************************************************************************// // // // Copyright (c) 1997. // // Richard D. Irwin, Inc. // // // // This software may not be distributed further without permission from // // Richard D. Irwin, Inc. // // // // This software is distributed WITHOUT ANY WARRANTY. No claims are made // // as to its functionality or purpose. // // // // Authors: James P. Cohoon and Jack W. Davidson // // Date: 7/15/96 // // Version: 1.0b // // // //**************************************************************************// // Program 9.1: Demonstrate some member functions and // auxiliary operators of the Rational ADT #include #include "rational.h" int main() { Rational r; Rational s; cout << "Enter rational number (a/b): " << flush; cin >> r; cout << "Enter rational number (a/b): " << flush; cin >> s; Rational t(r); Rational Sum = r + s; Rational Product = r * s; cout << r << " + " << s << " = " << Sum << endl; cout << r << " * " << s << " = " << Product << endl; return 0; }