动态数组的应用

来源:互联网 发布:石家庄创客儿童编程 编辑:程序博客网 时间:2024/05/01 12:33

动态数组的应用
研究问题:实现文字倒序
Dim a()  '声明一动态数组
Private Sub Command1_Click()
   Dim n as integer
   Dim wz as String
     wz=Text1.text
     n=Len(wz)   '取字符串wz的长度
   Redim a(1 to n) '指定数组的大小
   For i=1 to n
     a(i)=Mid(wz,i,1) '取字符串wz中的各个字符赋值给数组
   Next
   For i=n to 1 step-1
     Text2.text=Text2.Text & a(i)
   Next
End sub
固定数组的数组维数