Algorithms/Find maximum/vb script method 6

From Wikibooks, open books for an open world
Jump to navigation Jump to search

<script type="text/vbscript">

  function findMaxFourElement(i_intA,i_intB,i_intC,i_intD) 
    Dim o_intMax
    o_intMax = i_intA
    if ( i_intB > o_intMax ) then
       o_intMax = i_intB
    end if
    if ( i_intC > o_intMax ) then
       o_intMax = i_intC
    end if
    if ( i_intD > o_intMax ) then
       o_intMax = i_intD
    end if
    findMaxFourElement = o_intMax
  end function
  function findMaxThreeEle(i_intA,i_intB,i_intC)
    findMaxThreeEle = findMaxFourElement(i_intA,i_intB,i_intC,i_intC)
  end function
  Dim result
  result = findMaxThreeEle(1,2,3)
  document.write(result)
</script>