1、【
简答题】
Private Type Tele
Name As String * 15
Tel As String * 15
Pos As Long
End Type
Dim Pers As Tele
Dim RecNum As Integer
Private Sub Command1_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
RecNum = LOF(1) / Len(Pers)
Do
Pers.Name = InputBox("请输入姓名")
Pers.Tel = InputBox("请输入电话")
Pers.Pos = InputBox("请输入邮政编码")
' RecNum = ?
' Put #1, ?
asp = InputBox("More(Y/N)?")
' Loop While UCase(asp) ?
Close 1
End Sub
Private Sub Command2_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
' RecNum = ?
Cls
For i = 1 To RecNum
' Get #1, ?
Print Pers.Name; Pers.Tel; Pers.Pos
Next i
Close 1
End Sub
[10分]
解析:
Private Type Tele
Name As String * 15
Tel As String * 15
Pos As Long
End Type
Dim Pers As Tele
Dim RecNum As Integer
Private Sub Command1_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
RecNum = LOF(1) / Len(Pers)
Do
Pers.Name = InputBox("请输入姓名")
Pers.Tel = InputBox("请输入电话")
Pers.Pos = InputBox("请输入邮政编码")
RecNum = RecNum + 1
Put #1, RecNum, Pers
asp = InputBox("More(Y/N)?")
Loop While UCase(asp) <> "N"
Close 1
End Sub
Private Sub Command2_Click()
Open "t5.txt" For Random As #1 Len = Len(Pers)
RecNum = LOF(1) / Len(Pers)
Cls
For i = 1 To RecNum
Get #1, i, Pers
Print Pers.Name; Pers.Tel; Pers.Pos
Next i
Close 1
End Sub
2、【
简答题】
[10分]
解析:
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
3、【
简答题】
[10分]
解析:
Private Sub Command1_Click()
Command1.Caption = Label1
Label1.Visible = False
End Sub
4、【
简答题】
Private Sub Command1_Click()
For i = 0 To 3
' If ? = True Then
opt = Option1(i).Caption
End If
Next
' Select Case ?
Case "+"
Result = HScroll1.Value + HScroll2.Value
Case "-"
Result = HScroll1.Value - HScroll2.Value
Case "*"
Result = HScroll1.Value * HScroll2.Value
Case "/"
Result = HScroll1.Value / HScroll2.Value
End Select
' ? = Str(HScroll1.Value) & " " & opt & Str(HScroll2.Value) & " =" & Str(Result)
End Sub
[10分]
解析:
Private Sub Command1_Click()
For i = 0 To 3
If Option1(i) = True Then
opt = Option1(i).Caption
End If
Next
Select Case opt
Case "+"
Result = HScroll1.Value + HScroll2.Value
Case "-"
Result = HScroll1.Value - HScroll2.Value
Case "*"
Result = HScroll1.Value * HScroll2.Value
Case "/"
Result = HScroll1.Value / HScroll2.Value
End Select
Label4 = Str(HScroll1.Value) & " " & opt & Str(HScroll2.Value) & " =" & Str(Result)
End Sub
5、【
简答题】
[10分]
解析:
Private Sub C1_Click()
T1 = "等级考试"
End Sub
Private Sub C2_Click()
T1.Height = 2 * Me.T1.Height
T1.Width = 2 * T1.Width
T1.FontSize = 3 * Form1.T1.FontSize
End Sub
6、【
简答题】
[10分]
解析:
Private Sub Command1_Click()
If Option1.Value And List1.Text <> "" Then
Text1.Text = List1.Text & Option1.Caption
Else
If Option2.Value And List1.Text <> "" Then
Text1.Text = List1.Text & Option2.Caption
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out3.txt" For Output As #1
Print #1, Form1.List1.Text, Form1.Option1.Value, Form1.Option2.Value, Form1.Text1.Text
Close #1
End Sub
7、【
简答题】
Private Sub Command1_Click()
Dim i As Integer, j As Integer, iSum As Integer
Print "连续和为1250的正整数是:"
For i = 1 To 500
' iSum = ?
For j = i To 500
' iSum = ?
If iSum >= 1250 Then Exit For
Next
'If iSum = ? Then
Print i; " ~ "; j
End If
Next
End Sub
[10分]
解析:
Private Sub Command1_Click()
Dim i As Integer, j As Integer, iSum As Integer
Print "连续和为1250的正整数是:"
For i = 1 To 500
iSum = 0
For j = i To 500
iSum = iSum + j
If iSum >= 1250 Then Exit For
Next
If iSum = 1250 Then
Print i; " ~ "; j
End If
Next
End Sub
8、【
简答题】
[10分]
解析:
Private Sub C1_Click()
Text1.Text = LCase(Text1.Text)
Text2.Text = UCase(Text1.Text)
End Sub
9、【
简答题】
[10分]
解析:
Private Sub Op1_Click()
Text1 = "颐和园"
End Sub
Private Sub Op2_Click()
Text1.Text = "兵马俑"
End Sub
Private Sub Op3_Click()
Text1.Text = "西湖"
End Sub
10、【
简答题】
Private Sub Command1_Click()
Dim m As Integer, n As Integer
Do
n = Val(InputBox("请输入月份"))
' Loop Until ? And n < 13
' Select Case ?
Case 1, 2, 3
m = 1
Case 4, 5, 6
m = 2
Case 7, 8, 9
m = 3
Case 10, 11, 12
m = 4
End Select
' Select Case ?
Case 1
Text1.Text = Str(n) & " 月份是春季"
Case 2
Text1.Text = Str(n) & " 月份是夏季"
Case 3
Text1.Text = Str(n) & " 月份是秋季"
Case Else
Text1.Text = Str(n) & " 月份是冬季"
End Select
End Sub
[10分]
解析:
Private Sub Command1_Click()
Dim m As Integer, n As Integer
Do
n = Val(InputBox("请输入月份"))
Loop Until n > 0 And n < 13
Select Case n
Case 1, 2, 3
m = 1
Case 4, 5, 6
m = 2
Case 7, 8, 9
m = 3
Case 10, 11, 12
m = 4
End Select
Select Case m
Case 1
Text1.Text = Str(n) & " 月份是春季"
Case 2
Text1.Text = Str(n) & " 月份是夏季"
Case 3
Text1.Text = Str(n) & " 月份是秋季"
Case Else
Text1.Text = Str(n) & " 月份是冬季"
End Select
End Sub