1、【
简答题】
Option Base 1
Dim s As String
Private Sub Command1_Click()
Open App.Path & "\in5.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
End Sub
Private Sub Command2_Click()
' 考生编写
??????
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out5.dat" For Output As #1
Print #1, Text1.Text, Text2.Text
Close #1
End Sub
[10分]
解析:
Dim a(26) As Integer
n = Len(s)
For i = 1 To n
c = UCase(Mid(s, i, 1))
If c >= "A" And c <= "Z" Then
j = Asc(c) - Asc("A") + 1
a(j) = a(j) + 1
End If
Next i
Max = a(1)
t = Chr(Asc("A"))
For i = 2 To 26
If a(i) > Max Then
Max = a(i)
t = Chr(Asc("A") + i - 1)
End If
Next i
Text1.Text = t
Text2.Text = Max
2、【
简答题】
Private Sub C1_Click(Index As Integer)
Select Case Index
Case ?
Timer1.Enabled = False
Case 0
Timer1.Enabled = ?
End Select
End Sub
Private Sub Timer1_Timer()
Text1.Text = ?
End Sub
[10分]
解析:
Private Sub C1_Click(Index As Integer)
Select Case Index
Case 1
Timer1.Enabled = False
Case 0
Timer1.Enabled = True
End Select
End Sub
Private Sub Timer1_Timer()
Text1.Text = Text1.Text + 1
End Sub
3、【
简答题】
Dim s As Integer, h As Long
Private Sub Form_Load()
' Timer1.Enabled = ?
s = -40
End Sub
Private Sub Timer1_Timer()
Shape1.Move Shape1.Left, Shape1.Top + s
' If Shape1.Top = ? Then
s = -s
End If
' If Shape1.Top + ? = Line2.Y1 Then
s = -s
End If
End Sub
[10分]
解析:
'True
'Line1.Y1
'Shape1.Height
4、【
简答题】
[10分]
解析:
按要求解答即可
5、【
简答题】
[10分]
解析:
按要求解答即可
6、【
简答题】
Option Base 1
Private Sub Form_Click()
Const N = 5
Const M = 5
' Dim ?
Dim i, j, t
' Open App.Path & "\" & "datain.txt" ? As #1
For i = 1 To N
For j = 1 To M
' ?
Next j
Next i
Close #1
Print
Print "初始矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
For i = 1 To N
For j = 1 To M
t = Mat(i, 2)
Mat(i, 2) = Mat(i, 4)
' ?
Next j
Next i
Print
Print "交换第二列和第四列后的矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
End Sub
[10分]
解析:
Option Base 1
Private Sub Form_Click()
Const N = 5
Const M = 5
Dim Mat(M, N) As Integer
Dim i, j, t
Open App.Path & "\" & "datain.txt" For Input As #1
For i = 1 To N
For j = 1 To M
Input #1, Mat%(i, j)
Next j
Next i
Close #1
Print
Print "初始矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
For i = 1 To N
For j = 1 To M
t = Mat(i, 2)
Mat(i, 2) = Mat(i, 4)
Mat%(i, 4) = t
Next j
Next i
Print
Print "交换第二列和第四列后的矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
End Sub
7、【
简答题】
Dim a(100) As Integer
Private Sub Command1_Click()
Dim k As Integer
Open App.Path & "\in4.dat" For Input As #1
For k = 1 To 100
Input #1, a(k)
Next k
Close #1
End Sub
Private Sub Command2_Click()
'考生编写
???
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out4.dat" For Output As #1
Print #1, Combo1.Text; Text1.Text
Close #1
End Sub
Function even()
Dim s As Single, n As Integer
s = 0
For k = 1 To 100
If a(k) / 2 = Fix(a(k) / 2) Then
s = s + a(k)
n = n + 1
End If
Next
s = s / n
even = CInt(s)
End Function
Function odd()
Dim s As Single, n As Integer
s = 0
For k = 1 To 100
If a(k) / 2 <> Fix(a(k) / 2) Then
s = s + a(k)
n = n + 1
End If
Next
s = s / n
odd = CInt(s)
End Function
Function all()
Dim s As Single, n As Integer
s = 0
For k = 1 To 100
s = s + a(k)
Next
s = s / 100
all = CInt(s)
End Function
[10分]
解析:
Select Case Combo1.ListIndex
Case 0
Text1 = even()
Case 1
Text1 = odd()
Case 2
Text1 = all()
End Select
End Sub
8、【
简答题】
[10分]
解析:
Private Sub Cmd1_Click()
Line4.Visible = True
End Sub
Private Sub Cmd2_Click()
Line4.Visible = False
End Sub
9、【
简答题】
[10分]
解析:
Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub
10、【
简答题】
Dim s As Integer
Private Sub Command1_Click()
s = Val(InputBox("输入里程数(单位:公里)"))
End Sub
Private Sub Command2_Click()
If s > 0 Then
'Select Case ?
Case Is <= 4
'?
Case Is <= 15
' f = 10 + ?
'?
' f = 10 + ? + (s - 15) * 1.8
End Select
Text1.Text = f
Else
MsgBox "请单击“输入”按钮输入里程数!"
End If
End Sub
[10分]
解析:
Dim s As Integer
Private Sub Command1_Click()
s = Val(InputBox("输入里程数(单位:公里)"))
End Sub
Private Sub Command2_Click()
If s > 0 Then
Select Case s
Case Is <= 4
f = 10
Case Is <= 15
f = 10 + (s - 4) * 1.2
Case Else
f = 10 + (15 - 4) * 1.2 + (s - 15) * 1.8
End Select
Text1.Text = f
Else
MsgBox "请单击“输入”按钮输入里程数!"
End If
End Sub