一个求最大值与最小值的函数
程序员文章站
2022-05-21 08:13:21
function max(info) arr=split(info,",") max=clng(arr(0)) for i=1 to ubound(arr) if clng(arr...
function max(info)
arr=split(info,",")
max=clng(arr(0))
for i=1 to ubound(arr)
if clng(arr(i))>clng(max) then
max=clng(arr(i))
end if
next
end function
function min(info)
arr=split(info,",")
min=clng(arr(0))
for i=1 to ubound(arr)
if clng(arr(i)) min=clng(arr(i))
end if
next
end function
调用方式
i=max("12,23,12,12,,32,43,54,43,56")
i=min("12,12,23,3,454,34,4,5,45,3,232,3,2,43,4")
arr=split(info,",")
max=clng(arr(0))
for i=1 to ubound(arr)
if clng(arr(i))>clng(max) then
max=clng(arr(i))
end if
next
end function
function min(info)
arr=split(info,",")
min=clng(arr(0))
for i=1 to ubound(arr)
if clng(arr(i)) min=clng(arr(i))
end if
next
end function
调用方式
i=max("12,23,12,12,,32,43,54,43,56")
i=min("12,12,23,3,454,34,4,5,45,3,232,3,2,43,4")
上一篇: CentOS7联网初始化步骤教程
下一篇: Linux如何实现修改最大文件句柄数?