/* Experimental content: Combinatorial number solution formula is C .... Programming input m,n, output combination number, required to use a custom function to achieve factorial
* Yantai University Computer College Class 114-3 students
* Author: Liu Yang
* Time: March 4, 2012
* (2-1) The formula for solving the combinatorial number is C ... The programming input m,n, the output combination number, the request uses the custom function implementation to seek the factorial.
* Algorithm Description: */
#include <iostream>
using namespace std;
Long FAC (int n)
{
long double S=1;
while (n>0)
{
s=s*n;
--n;
}
return s;
}
int main ()
{
int m,n,t;
a long double a,b,c;
cout<< "Please enter the value of M:";
cin>>m;
cout<<endl;
cout<< "Please enter the value of N:";
cin>>n;
if (n!=0&&m>=n)
{
A=FAC (m);
B=FAC (n);
C=FAC (m-n);
t=a/(b*c);
cout<< "Combined number result:" <<t<<endl;
}
else
cout<< "No results" <<endl;
return 0;
}
Operation Result: