在multiD数组中排序和存储的问题

时间:2019-06-06 11:21:40

标签: vb.net sorting multidimensional-array

找不到原因,按提交后我的波数没有增加。同样,该数组也不意味着将每个评委的每个冲浪者分数从最高到最低排序。

赞:           大卫(冲浪者)  -马特7  -弗兰6.3  -山姆6  -顺5.5  -蒂姆4

那只冲浪者只浪了一浪。一个冲浪者最多可以冲浪5个波浪,因此每个冲浪者我将拥有5个波浪。目前,阵列将所有波分数混合成任意波数,对第1波的波分数与第2或3波的波分数的处理方式不同。

 Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    If txtScore.Text <= 10 Then
        recnoSurfer = CInt(Val(New Text.StringBuilder((From ch In cmbSurfer.Text.ToCharArray Where IsNumeric(ch)).ToArray).ToString))
        recnoJudge = CInt(Val(New Text.StringBuilder((From ch In cmbJudge.Text.ToCharArray Where IsNumeric(ch)).ToArray).ToString))
        i = 0
        Do While wavescore(recnoJudge, recnoSurfer, i) <> 0
            i = i + 1
            wavenum = i
        Loop
        If i < 6 Then
            txtwavenum.Text = wavenum + 1
            wavescore(recnoJudge, recnoSurfer, i) = txtScore.Text
            txtScore.Text = ""
        Else
            MsgBox("Maximum amount of waves have been met.")
            txtScore.Text = ""
        End If
    Else
        MsgBox("Score submitted invalid.")
        txtScore.Text = ""
    End If

    Dim swap As Decimal
    For k = 0 To 5
        For j = 0 To 4
            If wavescore(j, recnoSurfer, wavenum) < wavescore(j + 1, recnoSurfer, wavenum) Then
                swap = wavescore(j, recnoSurfer, wavenum)
                wavescore(j, recnoSurfer, wavenum) = wavescore(j + 1, recnoSurfer, wavenum)
                wavescore(j + 1, recnoSurfer, wavenum) = swap
            End If
        Next
    Next
    Console.WriteLine("......")
    For i = 0 To 4
        Console.WriteLine(wavescore(i, recnoSurfer, wavenum))
    Next
End Sub

任何帮助将不胜感激。

0 个答案:

没有答案