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

习题答案
考试通关必备网站

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

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;
未经允许不得转载:亿券答案网 » 【delphi源码】取memo控件中一组数字的中位数的函数

我来解答

匿名发表
  • 验证码: