skithesprings
Active member
help me out before 10:30 and I'll paypal you 5 bucks or 10 times the percentage I get on the assignment.
I have provided a template that contains a programmer-built function for factorial. I need to modify this program by adding another function that will perform the following calculation for combinations:
(nk) = (n!)/(k!(n-k)!)
where n and k are integer values.
the new function should be called from main and will call the factorial function. this new function should return the calculation above to main, and main should output the result. Do NOT use the same identifier (variable name) in more than one function. Make sure you have some test data before you try to write the program.
Hint: Complete this in two steps. In the first step write the new function to do the division
/(k(n-k))
and test it. Once the program is performing this calculation correctly, then modify the numerator and denominator of the fraction to call the factorial function.
here is what I have. the lines beginning with // are what I'm missing.
/*
The function is to calculate and the facorial of an integer number. The main function will
ask the user to input a number, then call the function, and output the factorial.
input: an integer number
output: The factorial of the integer number entered
processing: A function will be called that employs a loop to calculate the running product
for factorial of a number.
*/
#include
using namespace std;
int factorial (int); //function prototype or declaration
int main()
{
int somenumber, result;
cout
I have provided a template that contains a programmer-built function for factorial. I need to modify this program by adding another function that will perform the following calculation for combinations:
(nk) = (n!)/(k!(n-k)!)
where n and k are integer values.
the new function should be called from main and will call the factorial function. this new function should return the calculation above to main, and main should output the result. Do NOT use the same identifier (variable name) in more than one function. Make sure you have some test data before you try to write the program.
Hint: Complete this in two steps. In the first step write the new function to do the division
and test it. Once the program is performing this calculation correctly, then modify the numerator and denominator of the fraction to call the factorial function.
here is what I have. the lines beginning with // are what I'm missing.
/*
The function is to calculate and the facorial of an integer number. The main function will
ask the user to input a number, then call the function, and output the factorial.
input: an integer number
output: The factorial of the integer number entered
processing: A function will be called that employs a loop to calculate the running product
for factorial of a number.
*/
#include
using namespace std;
int factorial (int); //function prototype or declaration
int main()
{
int somenumber, result;
cout