Question
do not alter this driver file. my code will only output 7/3 when the exececution sample is 7/3 +1/3 = 8/3 with subtraction mulit and
do not alter this driver file. my code will only output 7/3 when the exececution sample is
7/3 +1/3 = 8/3
with subtraction mulit and division as well
#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 ";
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