1.
2.
3.
4.
5.
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()
Dim n As Integer, t As String, word_num As Integer
n = Len(s): t = ""
For i = 1 To n
c = Mid(s, i, 1)
If c <> " " Then
t = t + c
Else
If foundhuiwen(t) Then
word_num = word_num + 1
End If
t = ""
End If
Next i
Text1.Text = word_num
End Sub
'以下Function 过程用于判断字符串是否为回文
Function foundhuiwen(p As String)
'考生编写
6.
7.
8.
Private Sub Command1_Click()
Text1.Text = InputBox("请输入要添加的项目")
'List1.AddItem ?
End Sub
Private Sub Command2_Click()
Text1.Text = InputBox("请输入要删除的项目")
'For i = 0 To ?
'If List1.List(i) = ? Then
If List1.List(i) = Me.Text1.Text Then
'List1.RemoveItem ?
End If
Next i
End Sub
9.
Option Base 1
Private Function FindMax(a() As Integer)
Dim Start As Integer
Dim Finish As Integer, i As Integer
'Start = ?(a)
'Finish = ?(a)
'Max = ?(Start)
For i = Start To Finish
'If a(i) ? Max Then Max = ?
Next i
FindMax = Max
End Function
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
'arr1 = Array(Val(?), Val(?), Val(?), Val(?))
For i = 1 To 4
'arr2(i) = CInt(?)
Next i
'M = FindMax(?)
Print "最大值是: "; M
End Sub
10.
' 提供给考生的程序
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