主题:高手帮忙看一下这个VB程序
编写一个VB的歌手大赛评分系统
要求可以输入评委数量 选手数量 去掉最高和最低
然后可以计算平均分并且排名
Dim array1(,), array2(,) As Integer
Dim a '评委人数
Dim b '参赛选手人数
Dim d
Dim i, j, k, temp
Randomize()
a = Val(txtjudge.Text)
b = Val(txtnumber.Text)
ReDim array1(b, a + 4)
ReDim array2(b, 2)
For i = 1 To a
d = d & "评委" & i & " "
Next i
Print(" " & d & " 最高 最低 总分")
For i = 1 To b
Print(i & " 号选手 ")
array1(i, a + 1) = 0
array2(i, a + 2) = 100
array1(i, a + 3) = 0
For j = 1 To a
array1(i, j) = Val(InputBox("请输入第 " & i & " 号选手 第 " & j & " 位评委评分", "输入"))
If array1(i, j) > array1(i, a + 1) Then array1(i, a + 1) = array1(i, j)
If array1(i, j) > array1(i, a + 1) Then array1(i, a + 1) = array1(i, j)
If array1(i, j) < array1(i, a + 2) Then array1(i, a + 2) = array1(i, j)
array1(i, a + 3) = array1(i, a + 3) + array1(i, j)
Print(Format(array1(i, j), "#00") & " ")
Next j
array1(i, a + 3) = array1(i, a + 3) - array1(i, a + 1) - array1(i, a + 2)
array2(i, 1) = array1(i, a + 3)
array2(i, 2) = i
Print(Format(array1(i, a + 1), "#00") & " ")
Print(Format(array1(i, a + 2), "#00") & " ")
Print(Format(array1(i, a + 3), "#00") & " ")
Next i
'Print()
Print("歌曲大奖赛名次")
For i = 1 To b - 1
For j = i To b
If array2(i, 1) < array2(j, 1) Then
For k = 1 To 2
temp = array2(i, k)
array2(i, k) = array2(j, k)
array2(j, k) = temp
Next k
End If
Next j
Next i
Print(" " & d & " 最高 最低 总分")
For i = 1 To b
Print(array2(i, 2) & " 号选手 ")
For j = 1 To a + 3
Print(Format(array1(array2(i, 2), j), "#00") & " ")
Next j
'Print()
Next i
程序里调试的时候说Print函数这里有错
帮忙解答一下
要求可以输入评委数量 选手数量 去掉最高和最低
然后可以计算平均分并且排名
Dim array1(,), array2(,) As Integer
Dim a '评委人数
Dim b '参赛选手人数
Dim d
Dim i, j, k, temp
Randomize()
a = Val(txtjudge.Text)
b = Val(txtnumber.Text)
ReDim array1(b, a + 4)
ReDim array2(b, 2)
For i = 1 To a
d = d & "评委" & i & " "
Next i
Print(" " & d & " 最高 最低 总分")
For i = 1 To b
Print(i & " 号选手 ")
array1(i, a + 1) = 0
array2(i, a + 2) = 100
array1(i, a + 3) = 0
For j = 1 To a
array1(i, j) = Val(InputBox("请输入第 " & i & " 号选手 第 " & j & " 位评委评分", "输入"))
If array1(i, j) > array1(i, a + 1) Then array1(i, a + 1) = array1(i, j)
If array1(i, j) > array1(i, a + 1) Then array1(i, a + 1) = array1(i, j)
If array1(i, j) < array1(i, a + 2) Then array1(i, a + 2) = array1(i, j)
array1(i, a + 3) = array1(i, a + 3) + array1(i, j)
Print(Format(array1(i, j), "#00") & " ")
Next j
array1(i, a + 3) = array1(i, a + 3) - array1(i, a + 1) - array1(i, a + 2)
array2(i, 1) = array1(i, a + 3)
array2(i, 2) = i
Print(Format(array1(i, a + 1), "#00") & " ")
Print(Format(array1(i, a + 2), "#00") & " ")
Print(Format(array1(i, a + 3), "#00") & " ")
Next i
'Print()
Print("歌曲大奖赛名次")
For i = 1 To b - 1
For j = i To b
If array2(i, 1) < array2(j, 1) Then
For k = 1 To 2
temp = array2(i, k)
array2(i, k) = array2(j, k)
array2(j, k) = temp
Next k
End If
Next j
Next i
Print(" " & d & " 最高 最低 总分")
For i = 1 To b
Print(array2(i, 2) & " 号选手 ")
For j = 1 To a + 3
Print(Format(array1(array2(i, 2), j), "#00") & " ")
Next j
'Print()
Next i
程序里调试的时候说Print函数这里有错
帮忙解答一下