Private child cmd 1_click ()
Declare integer variable m integer variable n
M is an integer and n is an integer.
Digitize TXTXT 1 text and assign it to m txt2, and also assign it to n.
m = val(txt 1 . text):n = val(txt 2 . text)
Determine whether the input is numeric or empty.
If CSTR (m) <: & gttxt 1.text or CSTR (n) <; & gttxt2.text and then
Display error message
Laboratory. The values of caption = and n cannot be empty or contain non-numeric symbols! "
Exit subprocess
outlet connection
Otherwise, the following judgment is executed.
Otherwise if m<0 or n< then 0.
The values of Lab.caption = and n cannot be negative "
outlet connection
Elseif m> so
Laboratory. The value of caption = cannot exceed the value of n! "
outlet connection
If ... it will be over.
Call the handler after the judgment is completed.
lab.caption=""+cstr(cmn(m,n))
End joint
The function cnm passes in the parameter shaping cm shaping cn and returns the type single precision floating point.
The function cmn(cm is an integer and cn is an integer) is single precision.
Calling the fact function will eventually return the result.
Cmn = fact (cn)/ (fact (cm)* fact (cn-cm))
End function
Function fact parameter shaping k returns a single-precision floating point of type.
Function fact (k is an integer) is single precision.
Determines whether the passed-in value is equal to 0 or 1.
If k = 0 or k= 1
If the condition meets the return value 1.
Fact = 1
Otherwise.
other
Replacing factorial with the passed-in k value is equal to1* 2 * 3 * 4 * ... * K.
Finally return value.
Dim f is a single value and I is an integer.
f= 1
For i= 2 to k
f=f*i
Next, I
Fact =f
If ... it will be over.
End function