Write a C++ program that will output the number of distinct ways in which you can pick k objects out of a set of n objects (both n and k should be positive integers). This number is given by the following formula:
C(n, k) = n!/(k! * (n - k)!)
Your program should use 2 value-returning functions. The first one should be called Factorial and should return n! The second functions should be called Combinations and should return n!/(k! * (n - k)!). Test your program for different values of n and k 5 times (count-controlled loop). Check for errors in input.
#include <iostream>
usingnamespace std;
int factorial(int);
int combination(int, int);
void main(void)
{
int k_obj, n_obj, count;
count = 1;
while(count <= 5)
{
cout << "Please enter in number of k_obj ";
cin >> k_obj;
cout << "Please enter in the number of n_obj ";
cin >> n_obj;
count++;
}
cout << "The Factorial is " << factorial(n_obj) << " & the combination is " << combination << endl;
cout << endl;
}
and I go blank, any one willing to help or direct me to the right source