(2)
请在划线处填上合适的代码。
Const max = 1000
Dim n As Integer '存放学生人数
Dim xh(1 To max) As String, xm(1 To max) As String
Dim bj(1 To max) As Integer, fs(0 To max) As Single
Dim ffcj(1 To max) As Integer '数组ffdj存储学生的赋分等级
Dim ffdj(O To max) As String '数组ffcj存储学生的赋分成绩
Private Sub Form_ Load()
Dim i As Integer, km As String
Dim conn As New ADODB. Connect ion
Dim rs As New ADODB. Recordset
Conn.ConnectionString =“prov ider-microsoft.ace.oledb.12.0;data source=” +App. Path + “\s tudent. accdb”
conn. Open
Set rs. ActiveConnection = conn
Rs. Open' 'select * from stu_ info"
‘本过程其它代码从数据库中读入学生学号、姓名、班级和原始成绩存储到数组xh、xm、bj和fs中,并在List1中显示。学生数存储在变量n中。
Loop
End Sub
Private Sub Command1_ Click()
Dim q(1 To max) As Integer, p(1 To 8) As Single, dj(1 To 8) As String
Dimi As Integer,j As Integer, t As Integer, pos As Integer, last As Integer
Dim t1 As Integer, t2 As Integer, s1 As Single, s2 As Single
p(1) =0.03: p(2) = 0.07: p(3) =0.16: p(4) = 0.24
p(5) =0.24: p(6) =0.16: p(7) =0.07: p(8)=0.03
dj(1)="A : dj(2) = "B+*: dj(3) = "B": dj(4) = C+
dj(5)= "C: dj(6) = "D+*: dj(7) = "D": dj(8)="E”
For i=2 To 8 ‘计算到该等级累计所占比例
p(i) =________
Next i
For i=1 To n
q(i) = i
Next i
For i=1 To n- 1
For j=n To i+1 Step-1
If fs(q(j)) > fs(q(j - 1)) Then
t=q(j):q(j)=q(j-1):q(j-1)=t
End If
Next j
Next i
pos=1
t1=100:t2=91
For i =1 To 8
last=Int(n*p(i)+0.5)
Do While ________
last=last+1 ‘处理切分位置的同分数学生
Loop
s1 = fs(q(pos)): s2 = fs(q(last))
Do While pos <= last
________
ffcj(q(pos)) = t2 + (fs(q(pos)) - s2) / (s1 - s2) * (t1 - t2)
pos=pos+1
Loop
t1 = t1 -10:t2=t2- 10
Next i
For i=1 To n
List2. AddItem xh(q(i)) + xm(q(i)) + Str(bj(q(i))) + dj(ffdj(q(i))) +Str (ffcj(q(i)))
Nexti
End Sub