【加试题】某同学编写了一段模仿Excel的Rank排位函数VB程序,运行界面如图。程序功能如下:程序运行后先自动生成1000个取值范围在[1,100]的随机数(保留两位小数)并显示在List1中,在Text1和Text2中输入排序范围的起始位置和结束位置,在b(i)中存储a(i)在该范围中的排位,并输出排位到列表框List2,实现上述功能的VB程序如下,但加框处代码有错,请改正。Dim a(1 To 1000) As Single, b(1 To 1000) As Integer Private Sub Form_Load()
Randomize '生成 1000 个随机数 For i = 1 To 1000
① '产生随机数,保留二位小数
b(i) = 1 '初始排位为 1
List1.AddItem "a(" & i & ")=" & a(i) Next i
End Sub
Private Sub Command1_Click()
Dim ks As Integer, js As Integer
ks = Val(Text1.Text)
js = Val(Text2.Text)
For i = ks To js
For j = ks To js
If Then b(i) = b(i) + 1 ②
Next j
Text1 Text2
List2.AddItem "a(" & i & ")" & "在 a(" & ks & ")~a(" & js & ")中排位为" & b(i) Next i
End Sub
①{#blank#}1{#/blank#} ②{#blank#}2{#/blank#}