1.
2.
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
4.
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
5.
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
6.
7.
8.
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
9.
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.
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