填空题
在n个运动员中选出任意r个人参加比赛,有很多种不同的选法,选法的个数可以用公式 计算,下图窗体中3个文本框的名称依次是Text1、Text2、Text3。程序运行时在Text1、Text2中分别输入n和r的值,单击Command1按钮即可求出选法的个数,并显示在Text3文本框中(见下图)。请填空。 Private Sub Command 1_Click( ) Dim r As Integer, n As Integer n = Text1 r = Text2 Text3 =fun(n)/fun( 【13】 )/fun(r) End Sub Function fun( n As Integer)as long Dim t As Long x=1 Fork =1 Ton t=t*k Next fun =t End Function
【参考答案】
n-r
点击查看答案&解析
热门
试题
填空题
下面程序是由鼠标事件在窗体上画图,如果按下鼠标将可以画图,双击窗体可以清除所画图形。补充完整下面的程序。 首先在窗体层定义如下变量: Dim PaintStart As Boolean 编写如下事件过程: Private Sub Form_Load ( ) DrawWidth = 2 ForeColor = vbGreen End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) PaintStart = True End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, _ X As Single, Y As Single) If PaintStart Then PSet (X, Y) End If End Sub Private Sub Form_MouseUp (Button As Integer, Shift As Integer, _ X As Single, Y As Single) 【14】 End Sub Private Sub Form_DblClick( ) Cls End Sub
点击查看答案&解析