//--------------- MAIN.CPP --------------- // Driver routine to test SOME of the functions of the Fraction class #include // for cout #include "Fraction.h" // for Fraction declarations using namespace std; int main() { // Try all three possible fraction constructors // and the input/output routines. // These declarations use the default constructor Fraction f1, f2; // These declarations use the constructor with parameters Fraction f3(3,4), f4(6); // Use the objects cout << "\n The fraction f1 is "; f1.Show(); cout << "\n The fraction f2 is "; f2.Show(); cout << "\n The fraction f3 is "; f3.Show(); cout << "\n The fraction f4 is "; f4.Show(); cout << "\n Now enter first fraction: "; f1.Input(); cout << "\nYou entered "; f1.Show(); cout << "\n Now enter second fraction: "; f2.Input(); cout << "\nYou entered "; f2.Show(); // Finally, find the floating-point value of f1 and f2 cout << "\n The value of fraction 1 is " << f1.Evaluate() << '\n'; cout << "\n The value of fraction 2 is " << f2.Evaluate() << '\n'; cout << "Goodbye!\n"; } /* Sample Run: The fraction f1 is 0/1 The fraction f2 is 0/1 The fraction f3 is 3/4 The fraction f4 is 6/1 Now enter first fraction: 1/2 You entered 1/2 Now enter second fraction: 3/5 You entered 3/5 The value of fraction 1 is 0.5 The value of fraction 2 is 0.6 Goodbye! */