全国计算机等级考试二级VB程序设计模拟试题七
分类: 计算机
时间: 2023-10-09 18:17:38
作者: 全国等级考试资料网
写出下面程序的运行结果(10分)
1. Private Sub Command1_Click()
x = 0
n = InputBox("")
For i = 1 To n
For j = 1 To i
x = x + 1
Next j
Next i
Print x
End Sub
程序运行后,单击命令按钮,如果输入5,则在窗体上显示的内容是:
2.
Option base 1
Private sub subp(b() As Integer)
for i=1 to 4
b(i)=2*i
next i
End Function
Private Sub Command1_Click()
Dim a() as integer
a(1)=5
a(2)=6
a(3)=7
a(4)=8
subp a()
for i= 1 to 4
print a(i)
next i
End Sub单击命令按钮后,程序的运行结果为:
1. 15 2. 2
4
6
8