内容发布更新时间 : 2024/11/9 9:44:14星期一 下面是文章的全部内容请认真阅读。
的圆。
Private Sub Form_MouseDown ( Button, Shift, X, Y ) Circle (X,Y), , End Sub 300,vbblue
26.按鼠标左键点击窗体,以点击点为圆心,以小于50的随机数为半径,画出一个圆形。
Private Sub Form_MouseDown(Button, Shift, X, Y ) If Button = Then R = Int (Rnd * )
Circle ( , ), R
End If End Sub 1,50,x,y 28.执行语句Line(100,100)-Step(50,100)后,CurrentX的值为 。 150
五、分析程序 ,选择运行结果
4.运行程序,显示的结果是 Private Sub Form_Click ( C) For k = 1 To 7
For j = 1 To 7
If k < j Then Print 1; Else Print 0; Next j Print Nextk End Sub
A.
B. C. D.
9. 运行程序时,单击命令按钮,则标签中显示的值是( D) Private Sub Command1_Click() Dim i As Integer,n As Integer (A) 3 (B) 4 For i=0 To 50
(C) 5 (D) 6 i=i+3
n=n+1
If i>20 Then exit for Next
Label1.caption=Str(n) End Sub
14.运行下列程序,单击命令按钮Command1,在窗体上输出的结果是
( D )
Private Sub Command1_Click() For K = 1 To 4 For N = 0 To K
(B) (C) (D) Print Chr(65 + (A) K);
Next N A AA B BB Print
BB BBB CC CCC Next K
End Sub CCC CCCC DDD DDDD
DDDD DDDDD EEEE EEEEE 击窗体后,17.执行下面程序,单
窗体上显示的内容是( D )
Private Sub Form_Click() Dim a
a = Array(\Print a(5), LBound(a), UBound(a) End Sub A.Fri 1 7 B.Fri 0 6 C.Sat 1 7 D.Sat 0 6
22.下面程序运行后,窗体上显示的内容是( D ) Private Sub Form_Click() Dim a(2, 3) As Integer (A)5 (B)4 (C)3 For i = 1 To 2
(D)出错 For j = 1 To 3 a(i, j) = i + j Next j Next i
Print a(i, j) End Sub
28.运行下列程序,图片框Picture1中显示的内容为( A )。 Private Sub Timer1_Timer() Dim i As Long Picture1.Cls Private Sub Form_Load() x = Picture1.ScaleWidth \\ 2 Timer1.Enabled = True y = Picture1.ScaleHeight Timer1.Interval = 50 - i + 1000 Picture1.Circle (x, y), End Sub 500 i = i + 10 End Sub A.一个圆形从Picture1的底边出现,逐渐上移并最终消失在Picture1的顶部边缘
B.一个圆形从Picture1的顶边出现,逐渐下移并最终消失在Picture1的底部边缘
C.一个圆形从Picture1的左边出现,逐渐右移并最终消失在Picture1的右边
D.一个圆形从Picture1的右边出现,逐渐右移并最终消失在Picture1的左边
29. 下面程序运行后输出的图形是( C )
Private Sub Form_Click()
Const angle = 3.14159 / 180 For I = 0 To 360 Step 30
X1 = 1000 + 900 * Cos(angle * I) Y1 = 1000 + 900 * Sin(angle * I) X2 = 1000 + 500 * Cos(angle * I) Y2 = 1000 + 500 * Sin(angle * I) Line (X1, Y1)-(X2, Y2) Circle (1000, 1000), 480 Next I End Sub (A)
(B)
(C)
(D)
六、设计程序题(每题10分)
2.在文本框中输入一个长数字串,单击“统计出现次数”按钮后,统计出现次数最多的数字及出现次数,并在标签Label1中显示结果。 Private Sub Command1_Click()
Dim t As String, s As Integer, c As String, n As Integer t = Text1.Text s = Len(t) For i = 1 To s c = Mid(t, i, 1)
If Asc(c) >= 48 And Asc(c) <= 57 Then n = n + 1 End If Next i
Label1.Caption = n End Sub
7. 产生随机数并找出其中的最大值和最小值。按命令按钮Command1,产生10个1000以内的随机正整数,显示在窗体上,找出其中的最大值和最小值,分别显示在标签Label1和Label2中。按命令按钮Command2结束程序运行。 Private Sub Command1_Click()
Dim a(1 To 10) As Integer, min As Integer, max As Integer