1.
2.
3.
4.
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
Print
Print
For i = 1 To N
For j = 1 To M
t = Mat(1, j)
Mat(1, j) = Mat(3, j)
' ?
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 x As Integer
Private Sub Command1_Click()
x = Val(InputBox("请输入正整数"))
End Sub
Private Sub Command2_Click()
'Select Case Combo1.?
Case 0
' MsgBox Str(x) & ?
Case 1
' MsgBox Str(x) & ?
Case Else
Exit Sub
End Select
End Sub
Private Function f1(ByVal x As Integer) As String
If x \ 2 <> x / 2 Then
f1 = "是奇数"
Else
f1 = "是偶数"
End If
End Function
'Private Function f2(ByVal x As Integer) ?
' If x Mod 7 = ? Then
f2 = "能被7整除"
Else
f2 = "不能被7整除"
End If
End Function
9.
'Private Flag As ?
Private Sub Form_Click()
If Flag Then
Shape1.Top = Shape2.Top
Shape1.Left = Shape2.Left
Flag = Not (Flag)
Else
' Shape1.Top = Shape2.Top + Shape2.Height - ?
' Shape1.Left = Shape2.Left + Shape2.Width - ?
Flag = Not (Flag)
End If
End Sub
Private Sub Form_Load()
Flag = True
End Sub
10.
' 提供给考生的程序
Option Base 1
Dim Arr1(20) As Integer
Dim Arr2(20) As Integer
' 提供给考生的程序
Sub ReadData1()
Open App.Path & "\" & "datain1.txt" For Input As #1
For i = 1 To 20
Input #1, Arr1(i)
Next i
Close #1
End Sub
' 提供给考生的程序
Sub ReadData2()
Open App.Path & "\" & "datain2.txt" For Input As #1
For i = 1 To 20
Input #1, Arr2(i)
Next i
Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
Open App.Path & "\" & Filename For Output As #1
Print #1, Num
Close #1
End Sub