Private Sub Command1_Click( ?。?br /> Dim n As Interger,j As Integer,m As Integer '(1) Do While n<1000'判斷是否為素數(shù) m=Int(Sqr(n)) For j=2 To m If n Mod j=0 Then Exit For Next j If j>m Then If hws(n)=Ture Then List 1.AddItemStr(n) EndIf EndIf n=n+2 Loop End Sub Function hws(n As Integer)As Boolean'判斷所給n是不是回文數(shù) Dim j,k As Integer Dim m As String Dim a As Integer,b As Integer hws=True m=Str(n) k=Len(m) For j=1 To k\2 a=Val(Mid(m,j,l) b='(2) If a<>b Then hws=False Exit For EndIf Next j End Function.
. (3)請在畫線處填入合適的代碼. Dim m(1 To 20)As String Dim s(1 To 20)As Integer Dim n As Integer Private Sub Form_Load( ?。?br /> Dim conn As New ADODB.Connection'定義新的數(shù)據(jù)庫連接 Dim rs As New ADODB.Recordset'定義數(shù)據(jù)庫的一個對象 conn.ConnectionString=“provider=Microsoft.ACE.OLEDB.12.0;data source=“& App.Path &“\fwdh.jye.ai“'設(shè)置conn的數(shù)據(jù)庫鏈接字符串 conn.Open'找開數(shù)據(jù)庫鏈接 Set rs.ActiveConnection=conn'設(shè)置rs的ActiveConnection屬性,關(guān)聯(lián)conn rs.Open“select * from fwdh“'打開數(shù)據(jù)庫中的表 fwdh n=0 Do While Not rs.EOF n=n+1 m(n)=rs.Fields(0) s(n)=rs.Fields(1) List1.AddItem rs.Fields(“姓名“)&““& rs.Fields(“成績“) rs.MoveNext Loop rs.Close conn.Close End Sub Private Sub command1_click ( ?。?br /> Dim x As String,y As Integer x=Text1.Text y=Val(Text2.Text) i=n Do While
'① s(i+1)=s(i) m(i+1)=m(i) i=i-1 Loop
'②
'③ For i=1 To n+1 List2.AddItem m(i)&““&Str(s(i)) Next i End Sub.