Scenario: Your little brother is learning fractions in school right now. He is c
ID: 3910845 • Letter: S
Question
Scenario: Your little brother is learning fractions in school right now. He is constantly asking you to help him and check his answers. So, you decide to write a program that will help him instead, so that you can get back to CSE 1342 stuff Your Mission: Write a program that will allow your little brother to enter a math problem involving two fractions. Here are a few different things he might need to be able to type in: 3/4+1/5 11/12-1/12 1/9 2/18 Some things to observe . Each problem entered will contain two fractions with either addition or subtraction in between them. Each part of a fraction (numerator or denominator) can be multiple digits. No decimals though. . . In the third example above, notice there are spaces around the+ sign. You'll need to account for this. . Denominators don't have to be the same No negative fractions . Your program should perform the mathematical operation that is requested in the problem on the two operands provided and output the answer in reduced fraction form. Everything should stay in fraction form (no mixed numbers necessary). When you output the answer, make it look nice (i.e. stack the fractions,): Your sis has a whole worksheet of problems to complete, so you should make your program loop so she can enter another problem after the answer to the previous problem has been displayed Make the user interface friendly... this is for your little sister after allExplanation / Answer
#include #include #include using namespace std; int menu (int); int aFraction(int, int, int, int, int, int); int sFraction(int, int, int, int, int, int); int mFraction(int, int, int, int, int, int); int dFraction(int, int, int, int, int, int); int main() { int op; int n1, d1, n2, d2, n3, d3; menu(op); if (op == 1) aFraction(n1, d1, n2, d2, n3, d3); if (op == 2) sFraction(n1, d1, n2, d2, n3, d3); if (op == 3) mFraction(n1, d1, n2, d2, n3, d3); if (op == 4) dFraction(n1, d1, n2, 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.