• 2022-05-31
    中国大学MOOC: Dim i,j,x For i=i To 20 step 2 x=0 For j=i To 20 step 3 x=x+1 Next j Next i Textl.Value=Str(x)End Sub文本框中显示的结果
  • 1

    内容

    • 0

      在窗体中有1个命令按钮Command1和1个文本框Text1,编写事件代码如下:Private Sub Command1_Click() For i=1 To 4 x=3 For j=1 To 3 For k=1 To 2 x=x+3 Next k Next j Next i Text1.Value=Str(x) End Sub 打开窗体运行后,单击命令按钮,文本框Text1输出的结果是

    • 1

      Public Sub Proc(a%( )) Static i% Do a(i) = a(i) + a(i + 1) i = i + 1 Loop While i < 2 End Sub Private Sub Command1_Click( ) Dim m%, i%, x%(10) For i = 0 To 4: x(i) = i + 1:  Next i For i = 1 To 2: Call Proc(x):    Next i For i = 0 To 4: Print x(i);:    Next i End Sub A: 3 4 7 5 6 B: 3 5 7 4 5 C: 2 3 4 4 5 D: 4 5 6 7 8

    • 2

      执行下列程序段后,x的值为( )。x = 10For i = 1 To 5 For j = 1 To 5 Step 2 x = x - 1 Next jNext i A: -5 B: 5 C: 10 D: 0

    • 3

      下列程序中 s = s + j 语句共执行了______次。 Dim s As Integer Dim i As Integer, j As Integer For i = 1 To 10 Step 2 For j = 1 To 5 Step 2 s = s + j Next j Next i Print s

    • 4

      使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next