• 2022-06-08
    编写如下程序: 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 运行程序,输出结果为______
  • 7 28

    内容

    • 0

      完成以下功能:计算分段函数完成程序。 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

    • 1

      设有如下通用过程,在窗体上画一个名称为command1的命令按钮,然后编写如下事件过程: private sub command1_click() dim x as integer x=10 y=5 y=f(x) print x;y end sub public function f (x as integer) dim y as integer x=20 y=2 f=x*y end function 程序运行后,如果单击命令按钮,则在窗体上显示的内容是()

    • 2

      运行下面的程序,第二行显示结果是___________。 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

    • 3

      中国大学MOOC: 下面的程序执行完后a,b的值分别为______。 Dim x, y, a, b As Integer x = 12 : y = 8 a = 1 : b = x * y Do While x Mod 2 = 0 And y Mod 2 = 0 x = x 2 y = y 2 a = a * 2 Loop Do While x <> y If x > y Then x = x - y Else y = y - x End If Loop a = a * x b = b a

    • 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 则以下说法中正确的是( )。