Private Sub Command1_Click()
CONST
   N=40000;
   Min=0.00001;
   Type
   pointdate=record;

x,y,z:single;

end;
date=array[1..n] ofpointdat;

function NDS(nn,a,b,mm:integer;sampledate:date):single;

Var
i,j,ic:integer;
s1,s2,d:single;
dis:array[1..mm] of real;
begin
  for i:=1 to mm do
  dis[i](a-sampledata[i].x)(a-sampledata[i].x)+(b-sampledata[i].y)(a-sampledata[i].y)
  s1:=0;
  s2:=0;
    for i:=1 to nn do begin
    ic:=1;
    for j:=1 to mm do
        if dis[j]<dis[ic]  then ic:=j;
    ifdis[ic]<min then begin
   ndc:=sampledata[ic].z;
      exit;
   end;
      d:=sqrt(dis[ic]);
      s1:=s1+sampledata[ic].z/d;
      s2:=s2+1/d;
      dis[ic]:=100 000;
      end;
      nds:=s1/s2;
      end.
   CONST
   N=40 000;
   Min=0.000 01;
Type
  pointdata=record;
  x,y,z:single;
  end;
  data=array[1..n] of pointdat;
griddata=array[1..15,1..15] of single;
procedure grid;
  var infile:textfile;filename:string;
  xx,yy,zz:single;
ii,i,j:integer;
   mygriddata:griddata;
    sample:data;
begin
   filename:='bhdemsub.txt';
   assignfile(infile,filename);
   reset(infile);
   ii:=1;
while not eof(infile)do begin
readIn(infile,xx,yy,zz);
sample[ii].x:=xx;
sample[ii].y:=yy;
sample[ii].z:=zz;
ii:=ii+1;
  end;
  close(infile);
  for i:=1 to 15 do begin
  for j:=1 to 15 do begin
  mygriddata[i,j]:=nds(7,i*6.3/15,j*6.2/15,25,sample);
    end;
  end;
    end.

End Sub

请高手帮忙看一下有什么问题