Question: Write a C++ program that asks for two rational numbers, it performs the multiplication of the two numbers. The result has to be in its

 Write a C++ program that asks for two rational numbers, it
performs the multiplication of the two numbers. The result has to be

Write a C++ program that asks for two rational numbers, it performs the multiplication of the two numbers. The result has to be in its simplest form, i.e., any common factors between the numerator and the denominator should be canceled out. For example, if the calculation result is 4/12, it should display as 1/3. To obtain the simplest form, the highest common factor (HCF) of the numerator and denominator is calculated. A template (Q3.cpp) is available in Blackboard. In the template, you are given the HCF function written in C++, using a recursive approach (which will be covered in subsequent lectures). If the resulting numerator is greater than or equal to the resulting denominator (in terms of their absolute magnitude), display the result in mixed numeral or as an integer respectively. Complete the program template so that it follows the input and output formats below: Sample 1 Please enter the numerator of the first rational number: 3 Please enter the denominator of the first rational number: 4 Please enter the numerator of the second rational number: 12 Please enter the denominator of the second rational number: 9 3/4 * 12/9 = 36/36 - 1/1 1 Sample 2 Please enter the numerator of the first rational number: 7 Please enter the denominator of the first rational number: 6 Please enter the numerator of the second rational number: 13 Please enter the denominator of the second rational number: 5 7/6 * 13/5 = 91/3e - 3 1/30 1 Sample 3 Please enter the numerator of the first rational number: 5 Please enter the denominator of the first rational number: 31 Please enter the numerator of the second rational number: 6 Please enter the denominator of the second rational number: 11 5/31 - 6/11 = 30/341

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!