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

Step: 3

blur-text-image

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 Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

4. Describe three kinds of personality units that are not traits.

Answered: 1 week ago