VB作业5,6

  • 格式:doc
  • 大小:63.00 KB
  • 文档页数:6

VB作业5(提交时间截止12月23日)
2、填空题
3、编程题
VB作业6
5(自测练习,提供参考答案及解答)单击窗体时,下列程序代码的执行结果为()。

Private Sub Form_Click( )
Text 2
End Sub
Private Sub Text( x As Integer )
x = x * 2 + 1
If x < 6 Then
Call Text( x )
End If
x = x * 2 + 1
Print x;
End Sub
A 23 47
B 11 35
C 22 45
D 24 51
6(自测练习,提供参考答案及解答)编写如下通用过程:Sub Proc(x As Single, y As Single)
t=x
x=t/y
y=t Mod y
End Sub
在窗体上画一个命令按钮,然后编写如下事件过程:Private Sub Command I_Click()
Dim a As Single
Dim b As Single
a=5
b=4
Proc a, b
Print a, b
End Sub
程序运行后,如果单击命令按钮,则输出结果为
A. 5 4
B. 1.25 1
C.4 5
D.1.25 5
7(自测练习,提供参考答案及解答)阅读程序:Function func(n As Integer) As Integer
Sum=0
For i=1 To n
Sum=Sum+(i+1)*i
Next i
func=Sum
End Function
Private Sub Command I_Click()
Dim a As Integer
a=5
s=func(a)
Print s
2、填空题
3、编程题。