VBI 68.PNG

Private Sub Command1_Click()
    Dim x, i, j, temp, rn(1 To 100), tm(1 To 100) As Integer
    Open "Marks.dat" For Input As #1
    i = 0
    Do While Not EOF(1)
        i = i + 1
        Input #1, rn(i), tm(i)
    Loop
    Close #1
    x = i
    For i = 1 To x - 1
        For j = i + 1 To x
            If tm(i) < tm(j) Then
                temp = tm(i)
                tm(i) = tm(j)
                tm(j) = temp
                temp = rn(i)
                rn(i) = rn(j)
                rn(j) = temp
            End If
        Next j
    Next i
    Cls
    Print "Roll No", "Total Marks"
    For i = 1 To x
        Print rn(i), tm(i)
    Next i
End Sub

VBO 68.PNG

Advertisements