Write a program that lets the user perform arithmetic operations on fractions. F
ID: 3635660 • Letter: W
Question
Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, in which a and b are integers and b does not equal 0. your program must be menu driven, allowing the user to select the operation (+ , - , * , or /) and input the numerator and denominator of each fraction. the program must have the functions listed: Function divideFractions: This function takes as input four integers representing the numerators and denominators of two fractions, divides the fractions, and returns the numerator and denominator of the result. (Notice that this function has a total of six parameters.)Explanation / Answer
Please rate. Thanks :) #include using namespace std; void menue(char&,int&,int&, int&, int&); void addFraction(int,int, int, int, int&, int&); void subtractFractions(char,int,int, int, int, int&, int&); void multiplyFractions(char,int,int, int, int, int&, int&); void divideFractions(char,int,int, int, int, int&, int&); int gethcf(int,int); void simplify(int&,int&); bool wishContinue(int&); int main() { int n1=0; int n2=0; int n3=0; int d1=0; int d2=0; int d3=0; int result=0; char operation; char slash='/'; menue(operation,n1,n2, d1, d2); if(operation == '+') addFraction(n1,n2, d1, d2, n3, d3); else if(operation == '-') subtractFractions(operation,n1,n2, d1, d2, n3, d3); else if(operation == '*') multiplyFractions(operation,n1,n2, d1, d2, n3, d3); else if(operation == '/') divideFractions(operation,n1,n2, d1, d2, n3, d3); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.