Question: The problem has to be in C++. CSCI/CMPE 1370 Lab 06 The Problem Write a program to do fractional arithmetic. To keep it a little
The problem has to be in C++.


CSCI/CMPE 1370 Lab 06 The Problem Write a program to do fractional arithmetic. To keep it a little shorter, we'll just do the subtraction and multiplication operations. It should also reduce the answer to its lowest form (e.g. 3/9 should be 1/3). It should not print silly things like 05 (should just be 0) or 7/1 (should just be 7). The user should be allowed to enter any number of problems A sample dialogue follows. The user responses are in gray Fractional Arithmetic Program This program will perform arithmetic on fractions Problems should be entered like this: 2/54/7 The allowed operations are subtraction and multiplication *) . Please enter your problem1/2- 1/4 The answer is: 1/4 Would you like to do another one? (y): Please enter your problem => 2/9.3/4 The answer is: 1/6 Would you like to do another one? (y): n Goodbye Some Rules 1. You must accept fraction equations from the user as above! No prompting for each number or operator individually. You can assume that the user always enters two valid fractions in the format x/y (where x and y are whole numbers and y is not zero), with a single character operator between them (- or *) 2. This program deals exclusively with fractions, and each fraction must be stored as 2 whole numbers. Therefore, it should use integer variables (no float or doubles!) Your program must be made using functions. You must have at least these eight functions: -A function to read in an equation 3. Functions to perform the two operations: - o Subtracting one fraction from another o Multiplying two fractions A function to reduce a fraction o ...which uses another function to find the GCD (see below) - A function to print a fraction (the answer)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
