實現(xiàn)上述功能的程序如下,加框處的代碼有錯,請改正。 Dim a(1To 10000)As Integer Dim n As Integer Private Sub Form_Load ( ?。?br />‘將1000以內的素數從小到大依次存入數組a中 ‘將素數的個數存入變量n中 End Sub Private Sub Command1_Click ( ?。?br />Dim i As Integer,j As Integer,mid As Integer Dim key As Integer,flag As Boolean key=Val(Text1.Text) If key>10000Or Not hws(key) Then MsgBox“輸入的數據不是10000以內的回文數“ Else i=1:j=n flag=False Do While mid=(i+j)\2 If key>a(mid) Then i=mid+1 ElseIf key<a(mid) Then j=mid-1 Else flag=True End If Loop If Not flag Then Label1.Caption=“該回文數不是素數“ Else Label1.Caption=“回文素數“+Str(key)+“是第“+Str(mid)+“個素數“ End If End If End Sub ‘自定義函數 hws(y)用于判斷y是否是回文數 Function hws(y As Integer) As Boolean Dim x As Integer,k As Integer x=0:k=y hws=True Do While k>0