In c++ Please answer the ques. 2 images is for the output. PLease following the output answer the ques Ques: Create a complete program that contains the following: a) Create a looping menu with the following options: 1. Calculate n! (n factorial). 2. Calculate n to the power of m. 3. Exit program. b) If option 1 is selected: - Request an integer value for n from 1 to 9 inclusive. - Validate that n is an integer. Re-enter n if n is not an integer. - Validate that n is less than 10. Re-enter n if n is not in the range. - Calculate and output n factorial(n!). c) If option 2 is selected: - Request integer values for n and m from 1 to 9 inclusive. - Validate that n and m are both integers Re-enter n and m if one of them is not an integer. - Validate that both n and m are from 1 to 9 inclusive. Re-enter n and m if one of them is not in the range. - Calculate and output n to the power of m. d) If option 3 is selected: - Exit the program. e) If an invalid option is selected: - Inform the user with the error. - Re-enter option. f) Use loops to create factorial and - Do not use library functions to do them. operations: power g) Use validate() function to validate all the input that is of improper type such as characters, symbols, or floats. 1) You may create your own factorial() and power() functions. But do not use any math functions such as pow(x,y) from library. 2) Add comments to explain the algorithm of your program. 3) Keep your project coding clear with your own programming style.
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
In c++ Please answer the ques. 2 images is for the output. PLease following the output answer the ques
Ques: Create a complete program that contains the following:
a) Create a looping menu with the following options: 1. Calculate n! (n factorial).
2. Calculate n to the power of m.
3. Exit program.
b) If option 1 is selected:
- Request an integer value for n from 1 to 9 inclusive. - Validate that n is an integer.
Re-enter n if n is not an integer.
- Validate that n is less than 10.
Re-enter n if n is not in the range.
- Calculate and output n factorial(n!).
c) If option 2 is selected:
- Request integer values for n and m from 1 to 9 inclusive. - Validate that n and m are both integers
Re-enter n and m if one of them is not an integer.
- Validate that both n and m are from 1 to 9 inclusive. Re-enter n and m if one of them is not in the range.
- Calculate and output n to the power of m.
f) Use loops to create factorial and
- Do not use library functions to do them.
operations:
power g) Use validate() function to validate all
the input that is of improper type such as characters, symbols, or floats.
1) You may create your own factorial() and power() functions. But do not use any math functions such as pow(x,y) from <cmath> library.
2) Add comments to explain the
3) Keep your project coding clear with your own
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images