I've got these 3 programming problems i need to do for my class and i can't seem to get all of them. here they are:
Expand the attached code to make the "Factorial Function" work.
Write a function to calculate Factorial
Factorial is defined as the product of every number from 1 through N
N!
5!=1x2x3x4x5
3!=1x2x3
1!=1
Exceptions
-----------
By Definition
0!=1
Negative Factorials are undefined. So if negative is entered let your function return a -1
Note all of your expansion work should happen in the "oe.cpp" file.
Files : Factorial.docx(10KB)
main.cpp(2KB)
oe.cpp(<1KB)
2:
Build upon the collection of functions from the oe.cpp file that manipulate a single number as discussed in class.
Once you've created a working "factorial" function (previous assignment) now create an additional function called "int summation(n)" that will return the sum of every number from 1 up to "n"
Note: all of your expansion work should happen in the "oe.cpp" file. Also modify the the "menu()" function in the "oe.cpp" file to include a sixth choice "summation"
See attachment for details
3:
isPrime Function
· <!--[endif]-->Expand the "oe.cpp" file to include a function called "bool isPrime(int n)" which given an integer "n" will return "true" if the number is prime, otherwise it will return "false."
A prime number is a number that's only divisible by 1 and itself. For example:
1, 3, 5, 7, 11, 13, 17, 19, 23
· <!--[endif]-->Expand the menu function to offer a choice to find whether or not a given number is prime.
Your menu should now display as:
Enter a number: 23
Math Operations
1. Find the cosine
2. Find the absolute value
3. Find Odd or Even
4. Find the Cube
5. Find the Factorial
6. Find the Summation
7. Find if Prime
8. Quit
Choice (1-8):
· <!--[endif]-->Expand the main to call on the "isPrime" function as necessary. If the user chooses option "7" then the program should indicate whether the given number is prime or not.
· <!--[endif]-->Let your program run repetitively now. After each given an answer let your program pause (system("pause")) by saying "Press any key to continue
" After pressing any key let your program return to the menu. If the user chooses option "8" then the program should exit.
not trying to get u guys to do the homework for me, lol just need some advice and or refrence where i can find how to do these
"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack