我是一个delphi的初学者,求助!!
var
Form1: TForm1;
implementation
{$R *.dfm}
var
m:array[1..6] of real;
function max1(m:array [1..6] of real):real;
var
i,j:integer;
k:real;
begin
for i:=1 to 6 do
for j:=i to 5 do
begin
if (m[i]>m[j]) then
begin
k:=m[i];
m[i]:=m[j];
m[j]:=k;
end;
end;
max1:=m[6];
end;
function min1( m:array [1..6] of real):real;
var
i,j:integer;
k:real;
begin
for i:=1 to 6 do
for j:=i to 5 do
begin
if (m[i]<m[j]) then
begin
k:=m[i];
m[i]:=m[j];
m[j]:=k;
end;
end;
min1:=m[6];
end;
function operate(m:array [ 1..6] of real):real;
var
i,j:integer;
min1,max1,sum:real;
begin
sum:=0;
for i:=1 to 6 do
begin
sum:=sum+m[i];
end;
min1:=min1(m);
max1:=max1(m);
sum:=sum-min1-max1;
sum:=sum/4;
operate:=sum;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
k:real;
begin
m[1]:=strtoint(edit1.text);
m[2]:=strtoint(edit2.text);
m[3]:=strtoint(edit3.text);
m[4]:=strtoint(edit4.text);
m[5]:=strtoint(edit5.text);
m[6]:=strtoint(edit6.text);
k:=operate(m);
edit7:=inttostr(k);
end;
end.
我想实现一个评委打分问题,m这个数组表示6位裁判的打分,需要的操作是:去掉一个最高分,去掉一个最低分,将剩余四个评委的打分求平均值得到该表演者的真实成绩,各位大神帮忙看看,是不是我的数组参数传送出问题了?