Question
driver #include using namespace std ; #include Frac2.h int main () { Fraction c( 7 , 3 ) , d( 3 , 9 ) ,
driver
#include
using namespace std;
#include "Frac2.h"
int main() {
Fraction c(7, 3), d(3, 9), x;
// c.printFraction();
cout c;
cout " + ";
// d.printFraction();
cout d;
cout " = ";
x = c + d;
// x.printFraction();
cout x;
cout ' ';
// c.printFraction();
cout c;
cout " - ";
// d.printFraction();
cout d;
cout " = ";
x = c - d;
// x.printFraction();
cout x;
cout ' ';
// c.printFraction();
cout c;
cout " * ";
// d.printFraction();
cout d;
cout " = ";
x = c * d;
// x.printFraction();
cout x;
cout ' ';
// c.printFraction();
cout c;
cout " / ";
// d.printFraction();
cout d;
cout " = ";
x = c / d;
// x.printFraction();
cout x;
cout ' ';
// c.printFraction();
cout c;
cout " is: ";
cout ((c > d) ? " > " : " );
// d.printFraction();
cout d;
cout " according to the overloaded > operator ";
cout ((c d) ? " : " >= ");
// d.printFraction();
cout d;
cout " according to the overloaded ";
/* uncomment this line for improved version
// Optional: 2 Bonus Points
// c.printFraction();
cout
cout
// d.printFraction();
cout
cout
cout
cout
cout
cout
cout
cout
x = c + c / d - d * c; // cascading use of operators
// x.printFraction();
cout
cout
*/ // uncomment this line for improve version
#ifdef _WIN32 // _WIN32 is used by visual C++
#if (_MSC_VER
system("pause");
#endif
#endif
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started