Question: please code using c++ you are to extend the fraction multiplication examples given in class to perform fraction addition (using struct only, not classes). Each

please code using c++

you are to extend the fraction multiplication examples given in class to perform fraction addition (using struct only, not classes). Each fraction only consists of a numerator and a denominator. The program will query the user for 2 fractions and then perform the addition. It should ask the user to provide another set of fractions to perform until the denominator of either fraction entered is 0.

For example if the user enters 2 3 1 3, it means that the 2 fractions are 2/3 and 1/3. The sum of these two fractions would be 1 / 1. Please make sure the sum is written in the reduced form (but not mixed fraction). In the above example, 3 / 3 is not reduced. Furthermore, if the result is 9/6, the reduced form is 3/2. You do not need to convert it to a mixed fraction.

In your program, you must use struct fraction data type, as in the lectures. When computing the sum, use a sum() function:

fraction sum(fraction f1, fraction f2)

Example execution:

Please enter 2 fractions (numerator denominator): 2 3 1 3

The sum is 1 / 1

Please enter 2 fractions (numerator denominator): 2 3 3 4

The sum is 17 / 12

Please enter 2 fractions (numerator denominator): 2 9 5 6

The answer is 19 / 18

Please enter 2 fractions (numerator denominator): 3 8 1 6

The answer is 13 / 24

Please enter 2 fractions (numerator denominator): 2 0 1 3

Good bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!