题库 题库

【简答题】


Private Type PalInfo
    Name As String * 8
    Tel As String * 10
    Post As Long
End Type
Dim pal As PalInfo
Private Sub Command2_Click()
    ch$ = ""
    For k = 1 To Len(Text1.Text)
        C$ = Mid$(Text1.Text, k, 1)
        If C$ >= "0" And C$ <= "9" Or C$ >= "a" And C$ <= "z" Or C$ >= "A" And C$ <= "Z" Then
            ch$ = ch$ + C$
        End If
    Next k
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, ch$
    Close #1
End Sub

参考答案

Private Sub Command1_Click()
'考生应编写的程序
    Open App.Path & "\in5.txt" For Random As #1 Len = Len(pal)
    For i = 1 To 5
        Get #1, i, pal
        Text1.Text = Text1.Text & pal.Name
        Text1.Text = Text1.Text & pal.Tel
        Text1.Text = Text1.Text & Str(pal.Post)
        Text1.Text = Text1.Text + vbCrLf
    Next
    Close 1
End Sub

相关试题