Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;

}

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
\#include \#include "Frac2.h" using namespace std; Fraction : Fraction() \{ numer =0; denom =1; \} Fraction : : Fraction(int a, int b) return x; CMakelistsitit moin.cpp Frac2h Fraction : operator > (Fraction\& a) if (numer / denom a. numer / a.denom) return false; ostream\& operator 1 ) f \} cout "/" a. denom endr; ndef LABPR0J5_FRAC2_H fine LABPR0J5_FRAC2_H nolude ing namespace std; ass Fraction \{ Fraction(); Fraction(int a; int b); Fraction operator+( Fraction\& a); Fraction operator-(Fraction\& a); Fraction operator*(Fraction\& a); Fraction operator/( Fraction\& a); bool operator>(Fraction\& a); booi operator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions