瑞文文摘

【delphi源码】取memo控件中一组数字的中位数的函数



标签:delphi自定义函数[过程]

delphi 取memo控件中一组数字的中位数的函数
function SortMemo(const m: TMemo):real;
var
N2:integer;
begin
with TStringList.Create do
begin
Sorted := True;
Text := m.Text;
m.Text := Text;
N2:=m.Lines.Count div 2;
If 2 * N2 = m.Lines.Count Then
SortMemo:=0.5 * (strtofloat(m.Lines.Strings[N2-1]) +strtofloat(m.Lines.Strings[N2]))
Else
SortMemo:=strtofloat(m.Lines.Strings[N2]);
Free;
end;
end;

上一篇:【教育文章】浅谈如何信息技术在小学数学教学的有效应用

下一篇:【六年级语文教案】跳水



瑞文软件工作室 版权所有 [冀ICP备17033643号]
[联系我们][访问电脑版]