在窗体上画一个命令按钮,其名称为Command1,然后编写如下事件过程: Private Sub Command1_Click( ) Dim i As Integer,x As Integer For

admin2009-02-13  39

问题 在窗体上画一个命令按钮,其名称为Command1,然后编写如下事件过程:        Private Sub Command1_Click(    )          Dim i As Integer,x As Integer          For i=l To 6             If i=1 Then x=i             lf i<=4 Then                x=x+1             Else                x=x+2             End lf           Next i         Print x       End Sub      程序运行后,单击命令按钮,其输出结果为

选项 A、9
B、6
C、12
D、15

答案1

解析 当i<=4循环完成后,x=5;当i等于5和6时,都是执行循环体内的 x=x+2,所以最后结果是x=9。
转载请注明原文地址:https://kaotiyun.com/show/2K2p777K
0

最新回复(0)