问题 填空题

以下程序的功能是:从键盘上输入若干个学生的考试分数,当输入负数时结束输入,然后输出其中的最高分数和最低分数。在【12】和【13】处填入适当的内容,将程序补充完整。
Private Sub Form_Click()
Dim x As Single,amax As Single,amin As Single
x=InputBox("Enter a score")
amax=x
amin=x
Do While 【12】
If x>amax Then
amax=x
End If
If 【13】 Then
amin=x
End If
x=InputBox("Enter a score")
Loop
Print"Max=";amax,"Min=";amin
End Sub

答案

参考答案:[12]x>=0 [13]x<amin或amin>x

解析: 当输入负数时结束输入循环,即当输入为非负数时执行循环,因此空[12]处的循环条件方x>=0。变量amax和amin分别记录最高分数和最低分数,当输入的分数x比amax大时,就更新amax为x;当输入的分数x比amin小时,就更新amin为x,因此空[13]处填写x<amin或amin>x.

填空题
多项选择题 案例分析题