#include<iostream>usingnamespace std;longdoubleprobability(int range,int choice);intmain(){int range1,choice1,range2,choice2;
cout<<"Please input first range , choice ,\n""then second range and choice.(q to quit)\n";while(cin>>range1>>choice1 && choice1<=range1 &&
cin>>range2>>choice2 && choice2<=range2){
cout<<"You have one chance in "<<probability(range1,choice1)*probability(range2,choice2)<<" to win."<<endl;
cout<<"Next case:";}return0;}longdoubleprobability(int range,int choice){longdouble result=1.0;int b;int a;for(a=range,b=choice;b>0;--a,--b)
result*=(longdouble)a/b;return result;}