Dim a(10) As Integer
Private Sub Command1_Click()
p = Val(InputBox("请输入需要插入的位置:", "插入的位置"))
x = Val(InputBox("请输入需要插入的数值:", "插入的数值"))
For i = 6 To p Step -1
a(i + 1) = a(i)
Next i
a(p) = x
Print "执行插入之后的数组:"
For i = 1 To 7
Print a(i);
Next i
End Sub
Private Sub Command2_Click()
p = Val(InputBox("请输入需要删除的位置:", "删除的位置"))
For i = p To 6
a(i) = a(i + 1)
Next i
Print "执行删除之后的数组:"
For i = 1 To 6
Print a(i);
Next i
End Sub
Private Sub Form_Click() ‘单击窗体初始化数组
Print "数组中的初始值为:"
For i = 1 To 6
a(i) = Val(InputBox("请输入A(" & i & ")", "建立数组"))
Print a(i);
Next i
End Sub