- 1、本文档共21页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
计算机上机总结
1.Private Sub Clock_Click()
Label1.Caption = Time
End Sub。。。。。。。。。。。。。。。。。。显示系统当前时间
2.Private Sub Command2_Click()。。。。。。。。。二分法查找法
Dim low As Integer, high As Integer
Dim flag As Integer
Text2.Text =
x = InputBox(请输入需要查找的数, 输入)
low = LBound(a)
high = UBound(a)
Do
m = (low + high) \ 2
Select Case a(m)
Case Is = x
flag = 1
Exit Do
Case Is x
high = m - 1
Case Else
low = m + 1
End Select
Loop Until low high
If flag = 1 Then
Text2.Text = 查找成功,该数的位置为 + Str(m) + !
Else
Text2.Text = 查找失败,该数不存在!
End If
End Sub
3.Dim Flag As Boolean
Private Sub Form_Load()
DrawWidth = 1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Flag = True
End If
End Sub
Private Sub Form_mousemove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Flag Then
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
4. 计算1^1+2^2+3^3+……+n^n
Private Sub Command1_Click()
===============考生编写程序开始=====================
Dim i, j As Integer, k As Long
i = Text1.Text
k = 0
For j = 1 To i
k = k + f(j)
Next
Text2.Text = k
===============考生编写程序结束=====================
Open App.Path \out5.dat For Output As #1
Print #1, Text1, Text2
Close #1
End Sub
Private Function f(m As Integer) As Long
s = 1
For i = 1 To m
s = s * m
Next
f = s
End Function
5.判断平方数
Private Sub Command2_Click()
Dim n As Integer
n = 0
For k = 1 To 100
If a(k) 0 Then
d = Sqr(a(k))
If Int(d) = d Then
n = n + 1
b(n) = a(k)
End If
End If
Next
Call sort(b, n)
For k = 1 To n
Text2.Text = Text2.Tex
文档评论(0)