题型:综合题 题类:模拟题 难易度:困难
浙江省杭州市2016年信息技术高考模拟卷十四
程序运行界面如图所示,左边列表框List1中显示的是会员卡号和余额,在文本框Text1中输入会员卡号,单击"查询余额"按钮(Command1)后,如果找到此卡号,则在标签Label2中显示"此卡号余额为"和卡号对应的余额值,如果未找到则显示"找不到此卡号,请重新输入"。
解决此问题的部分程序段如下:
Dim kh (1 To n) As Long
Dim ye (1 To n) As Single
Private Sub Command1_Click()
Dim x As Long, i As Long, j As Long, m As Long, f As Boolean
x = Val(Text1.Text)
i = 1: j = n: f = False ‘ 设卡号总数为n
Do While ①
②
If x = kh (m) Then
f = True
ElseIf x < kh (m) Then
j = m - 1
Else
③
End If
Loop
If f Then
Label2.Caption = "此卡号余额为" + Str(ye(m)) + "元"
Else
Label2.Caption = "找不到此卡号,请重新输入"
End If
End Sub
Private Sub Form_Load()
’此过程用于对数组kh和数组ye进行初始赋值,代码略
End Sub
试题篮