Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program Create a program that performs mathematical operations on fractions. The program should present the user with a menu with the following choices: 1.

C++ Program

Create a program that performs mathematical operations on fractions. The program should present the user with a menu with the following choices:

1. Addition

2. Subtraction

3. Multiplication

4. Division

5. Exit

Use and enumerated data type for the menu choices:

enum mathOperation {ADD, SUBTRACT, MULTIPLY, DIVIDE}

You will need a function to display the menu and get the user's choice. A loop that displays the menu and test the user's choice is the only code that belongs in main().

Each menu choice will need a function except Exit.

You will also need a function to get the 2 fractions from the user. Ask the user to enter the fractions in fraction format, numerator/denominator (ex. 1/2). You will use string functions to parse out the numerator and denominator. (You will use the substr, length, compare, and append functions)

After the math is preformed on the fractions, you will need another function to reduce the results. Then print the results to the screen in the following format:

The sum of 1/2 + 2/4 = 3/4

NO Global Variables can be used in your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

What is disclosure of cost method investment?

Answered: 1 week ago