在Form1上画1个命令按钮(C1),标题为`“等级考试”(3)
发布时间:2021-06-08
发布时间:2021-06-08
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Flag Then
Me.Circle (X, Y), 300
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then
Flag = False
End If
End Sub
步骤3:调试并运行程序,关闭程序后按题目要求存盘。 综合题步骤1:打开本题工程文件。
步骤2:打开代码编辑窗口,去掉程序中的注释,将问号改为正确的内容。
参考答案 Private Function f(m As Integer) As Long
s = 1
For i = 1 To m
s = s * m
Next
f = s
End Function
步骤3:在代码编辑窗口中的指定位置编写如下代码。
Private Sub Command1_Click()
'=======考生编写程序开始================
Dim i As Integer
Dim j As Integer
Dim total As Long
i = Text1.Text
For j = 1 To i
total = total + f(j)
Next
Text2.Text = total
'=========考生编写程序结束===============
Open App.Path & "\out5.dat" For Output As #1
Print #1, Text1, Text2
Close #1
End Sub
步骤4:按照题目要求调试和运行程序,然后按照题目要求存盘并关闭程序。