16.【加試題】從鍵盤(pán)鍵入一組無(wú)序整數(shù),比如依次輸入78,18,-3,0,8,-6,9,2,當(dāng)輸入為空時(shí),這組數(shù)據(jù)將在列表框List1中依次有序輸出,完善下面的VB程序,在橫線處填入合適的語(yǔ)句,完成程序設(shè)計(jì). List.Clear Const n=100 Dim a(-1 To n) As Integer Dim m As Integer,i As Integer Dim j As Integer Dim t As String,x As Integer m=0 t=InputBox(“請(qǐng)輸入X的值:“) Do While t<>““And m<n x=Val(t) i=m Do While x<a(i-1)And i>0
i=i-1 Loop a(i)=x
t=InputBox(“請(qǐng)輸入X的值:“) Loop For i=0 To m-1 List1.AddItem a(i) Next i.
17.【加試題】某單位招聘事業(yè)單位工作人員,2015年和2016年各有4000名和2600名考生報(bào)名,下列VB程序統(tǒng)計(jì)兩次考試都參加的考生信息.程序界面如圖所示,2015年和2016年的考生信息分別顯示在List1和List2中,點(diǎn)擊“統(tǒng)計(jì)”按鈕,在List3中顯示兩次都參加的考生信息和總?cè)藬?shù). (1)實(shí)現(xiàn)上述功能的VB程序如下,請(qǐng)?jiān)跈M線處填入合適的代碼. Dim a(1 To 4000)As String Dim b(1 To 2600)As String Private Sub Form_Load( ) Dim conn As New ADODB.connection Dim rs As New ADODB.Recordset Dim constr As String constr=“Provider=Microsoft.ace.OLEDB.12.0;“ constr=constr &“Data Source=“& App.Path+“\data\kaosheng.jye.ai“ conn.ConnectionString=constr conn.open( ) Dim sql As String Rem將參加2015年考試的考生身份證號(hào)碼按升序存放在a數(shù)組中 sql=“select*from kaoshenginfo where year='2015'order by sfzh asc“ rs.jye.ai sql,conn i=0 Do While Not rs.EOF i=i+1 a(i)=rs(“sfzh“) List1.AddItem (a(i)) rs.MoveNext Loop Rem將參加2016年考試的考生身份證號(hào)碼按升序存放在b數(shù)組中 sql=“select*from kaoshenginfo where year='2016'order by sfzh asc“ rs.jye.ai sql,conn i=0 Do While Not rs.EOF i=i+1 b(i)=rs(“sfzh“) List2.AddItem (b(i)) rs.MoveNext Loop End Sub Private Sub Command1_Click( ) Dim bot As Integer,top As Integer,m As Integer Dim i As Integer,ans As Integer'ans用于記錄兩次均參加考試的考生數(shù) ans=0 For i=1 To 2600 bot=1 top=4000 Do While bot<=top m=Fix((bot+top)/2) If a(m)=b(i) Then List3.AddItem a(m)
Exit Do ElseIf
Then top=m-1 Else
End If Loop Next i List3.AddItem“總計(jì)“+Str(ans)+“人次“ End Sub (2)分析上述代碼,在數(shù)據(jù)庫(kù)中用于存放考生身份證號(hào)碼的字段名稱(chēng)是