[填空题] 以下程序的功能是从键盘输入若干个学生的考试成绩,统计并输出最高分和最低分,当输入负数时结束输入。请填空。 Private Sub Command1_Click() Dim x,amax

13 查阅

[填空题] 以下程序的功能是从键盘输入若干个学生的考试成绩,统计并输出最高分和最低分,当输入负数时结束输入。请填空。

Private Sub Command1_Click()

Dim x,amax,amin As Single

x=InputBox("Enter a score")

amax=x

amin=x

Do While______

If x>amax Then

amax=x

End If

If______Then

amin=x

End If

x=InputBox("enter a score")

Loop

Print "max=";amax,"min=";amin

End Sub

参考答案:

x>0;x<amin

本题考查程序分析。amax和amin分别存放最大值和最小值,输入负数才结束,因此循环结束条件为x<0,如果输入的数据小于amin,那么更改amin的值,因此第二个空处的条件为x<amin。

计算机考试