用户从Text1中输入计划人数,单击“入围划线”按钮Command1,面试分数线显示在文本框Text2 中,入围面试最终人数显示在 Text3中,进入面试考生的考号和笔试成绩显示在List2列表框中,如果成绩相同,则按考号从小到大的顺序显示。程序界面如图所示。
Dim kh(1 To 500) As String, cj(1 To 500) As Integer
Dim n As Integer ′参加考试总人数
Private Sub Form_Load()
Dim conn As New ADODB.Conncction
Dim rs As New ADODB.Recordset
conn.ConnectionString = “Provider=Microsoft.ACE.OLEDB.12.0;datasource=”+App.Path + ”\BSCJ.accdb”
conn.Open
Set rs.ActiveConnection = conn
rs.Open “select * FROM scoreinfo”
′本过程其他代码略
End Sub
Private Sub Commandl_click()
Dim m As Integer, i As Integer, j As Integer
Dim t1 As Integer, t2 As String, flag As Boolean
For i = 1 To n - 1
For j = 1 To
If cj(i) < cj(j) Then
t1 = cj(i): cj(i) = cj(j): cj(j) = t1
t2 = kh(i): kh(i) = kh(j): kh(j) = t2
EleIf ① Then
t2 = kh(i): kh(i) = kh(j): kh(j) = t2
End If
Next j
Next i
m = ②
If m <= n Then
i = m
flag = Flase
Do While i < n And Not flag
If cj(i) = cj(i + 1) Then
i = i + 1
Else
③
End If
Loop
Text2.Text = Str(cj(m))
Text3.Text = Str(i)
For j = 1 To i
List2.Addltem kh(j) + “ ” + Str(cj(j))
Next j
Else
Text2.Text = “面试人数超过了总人数”
End If
End Sub