16.編寫“尋找平方根”程序,實現(xiàn)的功能為:計算[32000,40000]范圍內(nèi)數(shù)的平方數(shù),若該平方數(shù)十個數(shù)位上的數(shù)字正好是0123456789的不同組合,不重復、不缺失(每個數(shù)字均只能出現(xiàn)一次),則在列表List1中輸出,程序運行時,界面如圖所示.實現(xiàn)上述功能的VB程序如下,但加框處代碼有誤,請改正.把改正后的代碼填在題后的橫線上. Private Sub Command1_Click( ?。?br /> Dim a (0 To 9)As Integer Dim i As Long,n As Long Dim j As Integer,x As Integer,y As Integer List1.Clear For i=32000 To 40000 n=i*2'(1) For j=0 To 9 a(j)=0 Next j Do While n<>0 x=n Mod 10 a(x)=a(x)+1'(2) n=n\10 Loop y=0 For j=0 To 9 y=y+a(j) Next j If y=10 Then List1.AddItem Str(i)+“^2=“+Str(i^2) Next i End Sub (1)應(yīng)改為
17.小張同學方便大家進行選考科目的選擇,將全班同學七門學科的原始成績折算成對應(yīng)的標準分(避免了不同學科試卷難度各不相同的問題,標準分越高說明該學科成績越優(yōu)秀),存放于7xuan3.a(chǎn)ccdb數(shù)據(jù)庫的“bzf”表中,部分界面截圖如圖1所示.并且編寫了“選考科目推薦”程序,實現(xiàn)如下功能:在文本框Text1中輸入學生的學號,單擊“分析”按鈕Command1,在文本框Text2中顯示該學號及所推薦的三門學科.程序運行界面如圖2所示. Private Sub Command1_Click( ?。?br /> Dim a (1 To 7)As Single Dim b (1 To 7)As Integer Dim n As Integer,s As String,c As String Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset conn,ConnectionString=“provider=microsoft.ace.jye.ai.12.0;data source=“& App.Path &“\7xuan3.a(chǎn)ccdb“ conn.Open rs.ActiveConnection=conn n=Val (Text1.Text) rs.Open“select*from bzf where 學號=“& n For i=1 To 7 a(i)=
b(i)=i Next i rs.Close conn.Close For i=1 To 3 k=i For j=i+1 To 7 If a(j)>a(k) Then k=j Next j If k<>i Then t=a(i):a(i)=a(k):a(k)=t t=b(i):b(i)=b(k):b(k)=t End If Next i s=“物理化學生物政治歷史地理技術(shù)“ c=Text1.Text+““ For i=1 To 3 c=c+
+““ Next i Text2.Text=c End Sub (1)若在文本框Text1中輸入3,單擊“分析”按鈕Command1后,則文本框Text2中顯示的內(nèi)容為