Write a FRACTION calculator program with c++ that adds, subtracts, multiplies, and divides fractions. Your program should check for the division by 0, have and use the following functions: (a)  abs - returns the absolute value of a given integer. (b)  min - returns the smallest of two positive integers. (c)  gcd - returns the greatest common divisor of two positive integers. (d)  reduce - reduces a given fraction. (e)  flip - reduces a given fraction and flips the sign if the denominator is negative. (f)  add - finds the reduced sum of a pair of given fractions. (g)  subtract - finds the reduced difference of a pair of given fractions, by making the second fraction negative then using the add function. (h)  multiply - finds the reduced product of a pair of given fractions. (i)  divide - finds the reduced quotient of a pair of given fractions by inverting the second fraction then using the multiply function.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

Write a FRACTION calculator program with c++ that adds, subtracts, multiplies, and divides fractions. Your program should check for the division by 0, have and use the following functions:

  1. (a)  abs - returns the absolute value of a given integer.

  2. (b)  min - returns the smallest of two positive integers.

  3. (c)  gcd - returns the greatest common divisor of two positive integers.

  4. (d)  reduce - reduces a given fraction.

  5. (e)  flip - reduces a given fraction and flips the sign if the denominator is negative.

  6. (f)  add - finds the reduced sum of a pair of given fractions.

  7. (g)  subtract - finds the reduced difference of a pair of given fractions, by making

    the second fraction negative then using the add function.

  8. (h)  multiply - finds the reduced product of a pair of given fractions.

  9. (i)  divide - finds the reduced quotient of a pair of given fractions by inverting the second fraction then using the multiply function.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Recurrence Relation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr