阅读下面程序: Private Function a(load As Integer) As Single If load <20 then money = load/2 else money =20 + load end if a = money End Function Private Sub Form_Click( ) Dim load As Integer, fee As Single Load = InputBox("请输入一个数:") fee= a(loaD) Print fee End Sub输入20,运行后的输出结果是 【6】 。
举一反三
- 阅读下面程序。 Private Function a(load As Integer) As Single If load < 20 then money=load / 2 else money=20+load end if a=money End Function Private Sub Form Click() Dim load As Integer,fee As Single Load=InputBox("请输入一个数:") Fee=a(load) Print fee End Sub 输入20,运行后的输出结果是 【13】 。
- 运行以下程序时,由键盘为变量load输入的数据为20,输出结果为______。 Private Function Wei(load As Integer),Money As Single If load<20 Then Money=load/2 Else Money=20+load End if Wei=Money End Function Private Sub Form _Click() Dim load As Integer,fee As Single load=InputBox(“请输入一个数:”) fee=Wei(loaD) Print fee End Sub A: 10 B: 20 C: 30 D: 40
- 下列程序: Private Sub Form_Click () Dim load As Integer Load = InputBox(″请输入一个整数″) fee = Wei(load)-load Print fee,load End Sub Function Wei(load) If load < 20 Then Money = load/2 Else Money = 10 + load End if Wei = Money End Function 运行时从键盘为变量load提供的数据为20,输出结果是( )。
- 执行下列程序后,鼠标单击窗体,输出结果为( )。 Private Sub Form_Click() Print "Click"; End Sub Private Sub Form_MouseDown(Button As Integer, Shift A: As Integer,X As Single,Y As Single) B: Print "Down" C: End Sub D: Private Sub Form_MouseUp(Button As Integer, Shift_As Integer,X As Single,Y As Single) E: Print "Up" F: End SubA) DownUpClick G: B) ClickDownUp H: C) DownClickUp I: D) UpDownClick
- 写出下列程序的运行结果。 Private Sub Form_Click() Dim x%, y% x = InputBox("请输入一个整数") If x <= 30 And x > 10 Then If x > 20 Then If x < 25 Then y = 10 Else y = 20 End If Else If x > 15 Then y = 30 Else y = 50 End If End If End If Print y End Sub 假设输入18,则运行结果为