1、【
简答题】
Private Sub Form_Click()
If Option1.Value = True Then
Text1.Text = InputBox("请输入要添加的项目")
'List1.AddItem ?
End If
If Option2.Value = True Then
Text1.Text = InputBox("请输入要删除的项目")
'For i = 0 To ?
'If List1.List(i) = ? Then
'List1.RemoveItem ?
End If
Next i
End If
End Sub
[10分]
解析:
Private Sub Form_Click()
If Option1.Value = True Then
Text1.Text = InputBox("请输入要添加的项目")
List1.AddItem Text1.Text
End If
If Option2.Value = True Then
Text1.Text = InputBox("请输入要删除的项目")
For i = 0 To List1.ListCount - 1
If List1.List(i) = Text1.Text Then
List1.RemoveItem i
End If
Next i
End If
End Sub
2、【
简答题】
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
Open App.Path & "\" & "datain1.txt" For Input As #1
For i = 1 To 100
Input #1, Arr(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
[10分]
解析:
' 要求考生编写的程序
Dim Sum As Integer
' 要求考生编写的程序
Private Sub Read_Click()
ReadData
End Sub
' 要求考生编写的程序
Private Sub Calc_Click()
Dim S As String
Sum = 0
For i = 1 To 100
If Arr(i) < 50 Then
Sum = Sum + Arr(i)
S = S & Str(Arr(i)) & " "
End If
Next i
Text1.Text = S
Print "Sum = "; Sum
End Sub
' 要求考生编写的程序
Private Sub Save_Click()
WriteData "DataOut.txt", Sum
End Sub
3、【
简答题】
[10分]
解析:
Private Sub Add_Click()
Text1.Text = InputBox("请输入要添加的项目")
'List1.AddItem ?
List1.AddItem Text1.Text
End Sub
Private Sub Delete_Click()
Text1.Text = InputBox("请输入要删除的项目")
'For i = 0 To ?
For i = 0 To List1.ListCount - 1
'If List1.List(i) = ? Then
If List1.List(i) = Text1.Text Then
'List1.RemoveItem ?
List1.RemoveItem i
End If
Next i
End Sub
4、【
简答题】
[10分]
解析:
Private Sub Command1_Click()
Label1.Visible = 0
Text1.Visible = 0
Print Text1.Text
End Sub
5、【
简答题】
Option Base 1
Private Sub Sort(a() As Integer)
Dim Start As Integer, Finish As Integer
Dim i As Integer, j As Integer, t As Integer
'Start = ?(a)
'Finish = ?(a)
'For i = ? To 2 Step -1
'For j = 1 To ?
'If a(j) ? a(j + 1) Then
t = a(j + 1)
a(j + 1) = a(j)
a(j) = t
End If
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
Sort arr2()
Text1.Text = arr2(1)
Text2.Text = arr2(2)
Text3.Text = arr2(3)
Text4.Text = arr2(4)
End Sub
[10分]
解析:
Option Base 1
Private Sub Sort(a() As Integer)
Dim Start As Integer, Finish As Integer
Dim i As Integer, j As Integer, t As Integer
Start = LBound(a)
Finish = UBound(a)
For i = UBound(a) To 2 Step -1
For j = 1 To i - 1
If a(j) > a(j + 1) Then
t = a(j + 1)
a(j + 1) = a(j)
a(j) = t
End If
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
Sort arr2()
Text1.Text = arr2(1)
Text2.Text = arr2(2)
Text3.Text = arr2(3)
Text4.Text = arr2(4)
End Sub
6、【
简答题】
[10分]
解析:
Private Sub HScroll1_Change()
Text1.Width = HScroll1.Value * 1.2
Text1.Height = Me.HScroll1.Value
End Sub
7、【
简答题】
Option Base 1
Private Sub Sort(a() As Integer)
Dim Start As Integer, Finish As Integer
Dim i As Integer, j As Integer, t As Integer
'Start = ?(a)
'Finish = ?(a)
'For i = ? To 2 Step -1
'For j = 1 To ?
'If a(j) ? a(j + 1) Then
t = a(j + 1)
a(j + 1) = a(j)
a(j) = t
End If
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
Sort arr2()
Text1.Text = arr2(1)
Text2.Text = arr2(2)
Text3.Text = arr2(3)
Text4.Text = arr2(4)
End Sub
[10分]
解析:
Option Base 1
Private Sub Sort(a() As Integer)
Dim Start As Integer, Finish As Integer
Dim i As Integer, j As Integer, t As Integer
Start = LBound(a)
Finish = UBound(a)
For i = Finish To 2 Step -1
For j = 1 To i - 1
If a(j) < a(j + 1) Then
t = a(j + 1)
a(j + 1) = a(j)
a(j) = t
End If
Next j
Next i
End Sub
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
Sort arr2()
Text1.Text = arr2(1)
Text2.Text = arr2(2)
Text3.Text = arr2(3)
Text4.Text = arr2(4)
End Sub
8、【
简答题】
[10分]
解析:
Private Sub HScroll1_Change()
Text1.FontSize = Form1.HScroll1.Value
End Sub