Write a C/C++ program that will enable a user to enter two rational numbers and an operator. The program is designed to handle four operators: + , - , * and / ( plus, minus, multiplication and division). You must design the interface that is easy to use and has some error checks. The results should be displayed in such a manner that the original input and the computed output are easily readable. The output must be in displayed in a reduced form. Sample input: 3/7 + 1/14 Output: 1/2 This algorithm will include the computation of the gcd. Once the gcd is determined the output can be reduced. The following expressions shows the computation for each operation: n1/d1 + n2/d2 = (n1*d2 + n2*d1)/(d1*d2) n1/d1 - n2/d2 = (n1*d2 - n2*d1)/(d1*d2) (n1/d1)*(n2/d2) = (n1*n2)/(d1*d2) (n1/d1)/(n2/d2) = (n1*d2)/(d1*n2) Submit output that demonstrates the use and correctness of your algorithm. Test your program with the following input. 14/3 + 5/2 33/4 - 6/8 4/9 * 18/24 2/16 / 8/64
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Complete ownership and distribution copyrights to all work purchased.
Windows XP, MS Visual C++