题库 高中信息

题干

某客运公司为了合理地安排汽车运输,每年每月都会对汽车站的客运量进行统计,并保存到数据库。新的一年即将来临,客运公司准备制订明年的汽车排班计划。设计程序,从数据库中读取上一年的月客运量,并找出最大、最小月份,代码如下:
Dim a(1 To 12) As Integer
Private Sub Form_Load()
 ’本过程从数据库中读取上一年月客流量,并存储在数组a中,代码略
End Sub
Private Sub Command1_Click()
Dim max As Integer, min As Integer
Dim yx As Integer, yn As Integer
max = a(1)
min = a(1)
yx = 1
yn = 12 ……………………①
For i = 2 To 12
 If a(i) >= max Then
  max = a(i)
  yx = i
 End If
 If  a(i) <a(1) Then ………………②
  min = a(i)
  yn = i
 End If
Next i
Label1.Caption =“客流量最大在第” + Str(yx) +“月,共” + Str(max) +“人,客流量最小在第” + Str(yn) +“月,共:” + Str(min) +“人”
End Sub
该程序①、②处有错误,请在画线处填写正确代码。
①_____________________②_____________________
上一题 下一题 0.99难度 None 更新时间:2020-02-25 09:50:08

答案(点此获取答案解析)