VB 如何加快循环
来源:百度知道 编辑:UC知道 时间:2024/07/15 12:06:04
如:
a=array(4,6,8,,1,3,,5,8,,9,11..........)
for i=1 to 1000000
for j=0 to 100
if i=a(j) then s=i
next
next
请问:上面的循环有更快的算法吗?
a=array(4,6,8,,1,3,,5,8,,9,11..........)
for i=1 to 1000000
for j=0 to 100
if i=a(j) then s=i
next
next
请问:上面的循环有更快的算法吗?
if i=a(j) then s=i改成
If StrComp(i, a(j), 0) = 0 Then s=i
你的代码结果好像是算出数组A中的最大值.
如果是这样根本不需如此循环计算,有更简便的方法.
没有~