Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, Create a program that: 1) Displays a menu of functions that the user is able to pick from. If information is returned from

Using C++, Create a program that:

1) Displays a menu of functions that the user is able to pick from. If information is returned from a function (ie NOT a void function), then that information should be displayed outside of the function. Any information passed as an argument (in the parenthesis) should be obtained outside of the function and passed in when called.

a. void hello()

i. Will simply display the text Hello, world!

b. void printBetween(int a, int b)

i. Will print all numbers between a and b, including a and b, counting up

-- E.G. a = 3, b = 6, ouput = 3 4 5 6 (or can use newlines)

-- Order is unassumed, but data is displayed counting up

c. bool isPrime(int n)

i. Returns true to indicate n is prime, or false to indicate its not

-- A number n is prime if it is greater than 1 and not divisible by any of the numbers x in the range 1 < x < n

d. int leastCommonDenominator(int a, int b)

i. Returns the smallest number that is divisible by both a and b

-- Which means (answer % a) and (answer % b) are both 0

-- The least common denominator of 3 and 4 is 12

e. void squaredOpposite(double &n)

i. Sets the contents of the argument to be the squared value of n, with the opposite sign compared to n

-- E.G. input of 3 would result in output of -9

-- n is being passed as a reference variable, meaning changes made to it in the function will be reflected in the argument that was passed into the function call

2) Asks the user if they would like to return to step 1, or exit.

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

10. Why does DMA require cycle stealing?

Answered: 1 week ago

Question

3. Evaluate a Web-based training site.

Answered: 1 week ago