7.4

#include<iostream>


long double probability(unsigned numbers,unsigned picks);

int main()
{
	using namespace std;
	long double total;
	total=probability(47,5)*probability(27,1);
	cout<<"you have one chance in ";
	cout<<total;
	system("pause");
	return 0;
}

long double probability(unsigned numbers,unsigned picks)
{
	long double result=1.0;
	long double n;
	unsigned p;
	for(n=numbers,p=picks;p>0;n--,p--)
	{
		result=result*n/p;
	}
	return result;
}

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页