题库 题库

【简答题】

参考答案

Private Type StudInfo
    Name As String * 8
    Sex As String * 4
    Age As Integer
End Type
Dim Stud As StudInfo
Dim RecNum As Long
Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Random As #1 Len = Len(Stud)
    RecNum = 1
    Do While Not EOF(1)
        Get #1, RecNum, Stud
        Text1.Text = Text1.Text & Stud.Name
        Text1.Text = Text1.Text & Stud.Sex
        Text1.Text = Text1.Text & Str(Stud.Age)
        Text1.Text = Text1.Text + vbCrLf
        RecNum = RecNum + 1
    Loop
    Close 1
End Sub
Private Sub Command2_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text1.Text
    Close 1
End Sub

相关试题