dim i as long,j as long 
dim k as long 
  j=ubound(AA())
  k=AA(0)
  for i=0 to j
    if AA(i)>= K then k=AA(i)
  next
  

解决方案 »

  1.   

    使用下面這段代碼就可以了實現了
    temp=array(0)
    for i=1 to ubound(array()) step 1
        if temp <array(i) temp=array(i)
    next for
      

  2.   

    不好意思,寫錯了,是:
    temp=array(0)
    for i=1 to ubound(array()) step 1
        if temp <array(i) temp=array(i)
    next i 
      

  3.   

    dim i as long,j as long 
    dim k as long 
      j=ubound(AA())
      k=AA(0)
      for i=0 to j
        if AA(i)>= K then k=AA(i)
      next
      这段代码思想是正确的,但还可以改进.  k=AA(0)
      'k已经等于AA(0)了就不必从0开始循环了,就节约一次  'for i=0 to j
      for i=1 to j
        'AA(i)= K时,K已是最大值,不必再赋值给K
        'if AA(i)>= K then k=AA(i)
        if AA(i)> K then k=AA(i)
      next
      

  4.   

    to foolishtiger(吴文智):呵呵,老大你又耍人家啊。
      

  5.   

    aft_st_sd(浪子) : 用那段程式是不可能不行的啊,還不行嗎,說說出現的原因
      

  6.   

    fraser01(wang) :不會吧, 這樣的問題用二叉樹,看來他不來個消化不良才怪呢,哈哈……
      

  7.   

    对,强烈抗议!是uguess的算法,不是我的算法。我拥有自主版权的算法是用肉眼找。 呵呵
      

  8.   

    好象无这样的函数,(我太笨,没找到)
    不过可以使用Paramarray关键字。
    你可以创建一个函数,使之返回任意个数中最大值。
    Function MAX(frist as variant,paramarry args() as variant)as variant
       dim i as integer
       MAX=frist
       for i=0 to ubound(args)
          if args(i)>MAX then MAX=args(i)
       next
    end function