Question: Using C++: Create a structure Fraction which contains a numerator and a denominator. a. Write a function void printFraction(Fraction f)which prints out a fraction in
Using C++:
Create a structure Fraction which contains a numerator and a denominator.
a. Write a function void printFraction(Fraction f)which prints out a fraction in the following format; e.g. if the numerator is 2 and the denominator is 5, it will print out 2/5
b. Write a function Fraction mult(Fraction f1, Fraction f2) which returns a new fraction which is the product of f1 and f2.
c. Write a function Fraction add(Fraction f1, Fraction f2)which returns a new fraction which is the sum of f1 and f2. You may simply multiply each fraction by the others denominator to find a common denominator; e.g. (3/4)+(5/6) = (3*6/4*6)+(5*4/6*4) = 38/24. You do NOT have to reduce the fractions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
