Powershell 求一组数据中的第二大数字

内容:【推荐客户端:Live Writer】{回车产生<p>, Shift+Enter产生<br/>, Tab键产生缩进; } (不允许发布任何与政治相关的内容) 请输入内容

 

$intA.length
Get-date
[int]$big=0
[int]$small=-1
[int]$temp=0
forEach($temp in $intA)
{
    if($temp -ge $big)
    {       
        $small=$big      
        $big=$temp       
    }
    else
    { 
        if($temp -ge $small)
        {
            $small=$temp
        }
   
    }
}
$small
$big
Get-date

posted @ 2011-03-09 15:17  漠北水獭  阅读(161)  评论(0编辑  收藏  举报