展开全部
2种方法
1. 直接赋值,此法只适合和小数组
Dim myArray() as Integer ={1,2,3,4,5}
或Dim myArray(5)as integer
myArray(0)=1
myArray(1)=2
myArray(2)=3
myArray(3)=3
myArray(4)=5
myArray(5)=6
2.最常用的for next循环赋值
Dim myArray()as integer
For intCount as Integer= 0 to 5
myArray(intCount)=你要赋值的东西
Next
如果你要每个都不同那就这样:
Dim myArray()as integer
Dim FuZhi as integer
For Fuzhi as 0 to 5
For intCount as Integer= 0 to 5
myArray(intCount)=fuzhi
Next intCount
Next fuzhi
1. 直接赋值,此法只适合和小数组
Dim myArray() as Integer ={1,2,3,4,5}
或Dim myArray(5)as integer
myArray(0)=1
myArray(1)=2
myArray(2)=3
myArray(3)=3
myArray(4)=5
myArray(5)=6
2.最常用的for next循环赋值
Dim myArray()as integer
For intCount as Integer= 0 to 5
myArray(intCount)=你要赋值的东西
Next
如果你要每个都不同那就这样:
Dim myArray()as integer
Dim FuZhi as integer
For Fuzhi as 0 to 5
For intCount as Integer= 0 to 5
myArray(intCount)=fuzhi
Next intCount
Next fuzhi
展开全部
dim i,j,t
dim a(1 to 5) as integer
randomize
for i=1 to 5
restart:t=int((100-1+1)*rnd+1))
for j=1 to UBound(a)
if a(j)=t then
goto restart
end if
a(i)=t
print a(i)
next i
这里给a数组中的每个值赋一个不同随机初始值
dim a(1 to 5) as integer
randomize
for i=1 to 5
restart:t=int((100-1+1)*rnd+1))
for j=1 to UBound(a)
if a(j)=t then
goto restart
end if
a(i)=t
print a(i)
next i
这里给a数组中的每个值赋一个不同随机初始值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
只能为数组中的逐个元素赋初值
参考:
dim a(1 to 5) as integer
a(1)=2
a(2)=4
a(3)=5
a(4)=33
a(5)=89
参考:
dim a(1 to 5) as integer
a(1)=2
a(2)=4
a(3)=5
a(4)=33
a(5)=89
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询