• 2022-06-07
    以下程序的功能是求“x^3*5”表达式的值,其中x的值由文本框Text0输入,运算的结果由文本框Text1输出。 Private Sub Command0_Click() Dim x As Integer Dim y As Long Me.Text0=x y=x^3*5 Me.Text1=y End Sub 运行上述程序时,会有错误。错误的语句是
    A: Dim x As Integer
    B: Me.Text0=x
    C: Me.Text1=y
    D: Dim y As Long
  • B

    举一反三

    内容

    • 0

      有如下事件程序,运行该程序后输出结果是_________。 Private Sub Command33_Click() Dim x As Integer, y As Integer x=1:y=0 Do Until y<=25 y=y+x*x x=x+1 Loop MsgBox "x=" & x &",y=" & y End Sub A: x=1,y=0 B: x=4,y=25 C: x=5,y=30 D: 输出其他结果

    • 1

      编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______

    • 2

      完成以下功能:计算分段函数完成程序。 x2+1 (x<0) y= 2x+1 (0≤x<1) 3x3 (x≥1) Private Sub Command1_Click() Dim y As Single, x As Single x = InputBox("请输入x的值") If x() Then y = x * x + 1 () x < 1 Then y = 2 * x + 1 Else y = 3 * x ^ 3 End If Print x; y End Sub

    • 3

      运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub

    • 4

      Sub s1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x: x = y: y = t End Sub Sub s2(x As Integer, y As Integer) Dim t As Integer t = x: x = y: y = t End Sub 则以下说法中正确的是( )。