. Dim a(1 to 10)As Integer Private Sub form-Load( ?。?br />'產(chǎn)生10個(gè)隨機(jī)整數(shù),并顯示在標(biāo)簽Label1中 End sub Private Sub answer-Click( ?。?br /> Dim i As Integer,max As Integer,t As Integer,dz As Integer Max=0:t=1:dz=0 For i='① If a(i)<a(i+1)Then '② Else If max<t Then max=t If t>1 Then dz=dz+1:t=1 End If Next i '以下程序代碼處理最后幾個(gè)數(shù)正好屬于升序序列的情況 If t>1 Then If max<t Then max=t dz=dz+1 End If Text1.Text=Str(dz) Text2.Text=Str(max) End Sub.
17.某省學(xué)生信息技術(shù)學(xué)習(xí)平臺(tái)使用情況數(shù)據(jù)存儲(chǔ)在數(shù)據(jù)庫(kù)中,利用VB編寫一個(gè)程序,實(shí)現(xiàn)的功能:輸入一個(gè)積分的范圍,顯示該范圍內(nèi)的學(xué)生編號(hào)和對(duì)應(yīng)的積分.程序運(yùn)行界面如圖所示: 程序代碼如下,為實(shí)現(xiàn)以上功能,請(qǐng)?jiān)跈M線處填寫合適的代碼: Dim bh(10000)As String‘存儲(chǔ)學(xué)生編號(hào) Dim jf(10000)As Integer‘存儲(chǔ)學(xué)生獲得的積分值 Dim n As Integer‘存儲(chǔ)學(xué)生總?cè)藬?shù) Function Search(x As Integer)As Integer Search=0 i=1:j=n:flag=True Do While i<=j And flag=True m=Int((i+j)/2) If x=jf(m) Then flag=False
Elsef
Then i=m+1 End If Loop End Function Private Sub Form-Load( ?。?br />‘從數(shù)據(jù)庫(kù)中讀取學(xué)生編號(hào)和積分,分別存儲(chǔ)到bh數(shù)組和jf數(shù)組中,并按積分值從小到大排序,顯示在列表框Listl中 End Sub Private Sub Commandl-Click( ?。?br /> Dim Top As Integer,Bottom As Integer,Topxb As Integer,Bottomxb As Integer List2.Clear Top=Val(Text2.Text) If Top>Bottom Then t=Top:Top=Bottom:Bottom=t If Top>jf(n) Or Bottom<jf(1)Then Exi Sub Do While Search(Top)=0 Top=Top+1 Loop Do While Search(Bottom)=0 Bottom=Bottom-1 Loop Topxb=Search(Top) Do While jf(Topxb)=jf(Topxb-1)And Topxb>1 Topxb=Topxb-1 Loop Bottomxb=Search(Bottom) Do while jf(Bottomxb)=jf(Bottomxb+1)And Bottomxb<n Bottomxb=Bottomxb+1 Loop For i=