导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
may158 (may158)
★☆☆☆☆
-
盒子活跃会员
2004/3/8 16:19:52
标题:
怎样求一维数组元素的最大值、最小值?
浏览:1200
加入我的收藏
楼主:
一维数组a[0..9]=(0.02,0.73,0.59,0.79,0.77,0.74,0.58,0.83,0.96,0.75) 1、求出数组元素的最大值、最小值分别用ab、al表示。 2、怎样判断该数组元素中最多有3个或4个元素不在某一个区间内如[0.60-1]区间。即如果有7个或6个元素在此区间则向下计算,否则重新选择数组。 谢谢!
----------------------------------------------
-
作者:
2004/3/8 16:27:12
1楼:
var i,iCount:integer; ab:=0; al:=1; iCount:=0; for i:=0 to 9 do begin if a[i]>ab then ab:=a[i]; if a[i]<al then al:=a[i]; if a[i]<0.06 then inc(iCount); end;
----------------------------------------------
-
作者:
2004/3/8 16:32:07
1楼:
1.冒泡你会冒吧! 2. who:=0; for i:=0 to 9 do if (a[i]>0.60)and(a[i]<1) then who:=who+1; if who>3 then 3元素不在区间[0.60-1]内
----------------------------------------------
我来自农村广阔的田野我的每一个动作都很夸张http://waterstone.51r.com