VB下面程序对产生的10个随机数进行排序,程序中有3个错误,请在相应的行上改正Private Sub Button1_Click(……) HandlesButton1.ClickDim a(9) As IntegerDim i,j,imin,t As IntegerLabel1.Text = "原始成绩为:" & vbCrLfFor i
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 13:00:35
VB下面程序对产生的10个随机数进行排序,程序中有3个错误,请在相应的行上改正Private Sub Button1_Click(……) HandlesButton1.ClickDim a(9) As IntegerDim i,j,imin,t As IntegerLabel1.Text = "原始成绩为:" & vbCrLfFor i
VB下面程序对产生的10个随机数进行排序,程序中有3个错误,请在相应的行上改正
Private Sub Button1_Click(……) HandlesButton1.Click
Dim a(9) As Integer
Dim i,j,imin,t As Integer
Label1.Text = "原始成绩为:" & vbCrLf
For i = 1 To 10
a(i) = Int(Rnd() * 101)
Label1.Text &= a(i) & " "
Next
For i = 0 To 8
For j = 9 To i + 1
If a(j) < a(j - 1) Then
t = a(i)
a(j) = a(j - 1)
a(j - 1) = t
End If
Next j
Next i
Label2.Text = "排序后的成绩为:"& vbCrLf
For i = 0 To 9
Label2.Text &= a(i) & " "
Next i
End Sub
VB下面程序对产生的10个随机数进行排序,程序中有3个错误,请在相应的行上改正Private Sub Button1_Click(……) HandlesButton1.ClickDim a(9) As IntegerDim i,j,imin,t As IntegerLabel1.Text = "原始成绩为:" & vbCrLfFor i
For i = 1 To 10 改为 For i = 0 To 9
For j = 9 To i + 1 改为 For j = 9 To i + 1 step -1
t = a(i) 改为 t = a(j)