题库 题库

【简答题】

参考答案

Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Input As #1
    Input #1, a%
    Text1.Text = a%
    Close #1
End Sub
Private Sub Command2_Click()
    a% = CInt(Text1.Text)
    Do
        a% = a% + 1
    Loop Until isprime(a%)
    Text2.Text = a%
End Sub
Function isprime(a As Integer)
    Dim flag As Boolean
    k% = 2
    flag = True
    While k% <= Int(a / 2) And flag
        If a / k% = Int(a / k%) Then
            flag = False
        End If
        k% = k% + 1
    Wend
    isprime = flag
End Function
Private Sub Command3_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub

相关试题