home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0905.CPP
-
- //---------------------------------------------------------
- // files in this example:
- // %F,15,EX0900.H%EX0900.H definition of Fraction class
- // %F,15,EX0900.CPP%EX0900.CPP Fraction members & friends
- // EX0905.CPP this file
- //---------------------------------------------------------
-
- #include <iostream.h>
- #include "EX0900.H"
-
- void main()
- {
- Fraction a, b(.25), c(0.5); // create Fraction objects
-
- cout << "The initial value of a is: ";
- cout << a;
- cout << endl;
-
- cout << "The initial value of b is: ";
- cout << b;
- cout << endl;
-
- cout << "The initial value of c is: ";
- cout << c;
- cout << endl << endl;
-
- a = b; // assign fraction a to fraction b
- cout << " The value of a = b is: ";
- cout << a;
- cout << endl;
-
- a.operator=(c); // call assignment operator
- cout << "The value of a.operator=(c) is: ";
- cout <<a;
- cout << endl;
- }
-