hi
I writing code, and I encounter some errors. I don't understand what these error means. I would be thankful to anyone who could help me solve and understand these errors.
these are the error codes:
Compiling trashprogram#2.pas
trashprogram#2.pas(18,32) Error: Fields cannot appear after a method or property definition, start a new visibility section first
trashprogram#2.pas(27,2) Error: Wrong number of parameters specified for call to "pangkat"
trashprogram#2.pas(18,11) Error: Found declaration: pangkat(SmallInt;SmallInt);
trashprogram#2.pas(33,45) Error: Operator is not overloaded: "untyped" + "untyped"
this is the code
program trashprogram2;
var
siswa: array[1..2,1..1000] of shortint;
D, N,i,max,min,j : integer;
temp: longint;
function abs_(x: integer) : integer;
begin
if (x < 0) then begin
abs_:=-1*x
end else begin
abs_:=x;
end;
end;
procedure pangkat(x,y: integer): longint;
var
temp: longint;
j: shortint;
begin
temp:=1;
for j:=1 to y do begin
temp:=temp*x;
end;
pangkat:=temp;
end;
function T(i,j: integer) : longint;
begin
T:=pangkat(abs_(siswa[1][i]-siswa[1][j]),D)+pangkat(abs_(siswa[2][i]-siswa[2][j]),D)
end;
begin
readln(D,N);
for i:=1 to N do begin
readln(siswa[1][i],siswa[2][i]);
end;
max:=T(1,2);
min:=T(1,2);
for i:=1 to N do begin
for j:=1 to N do begin
if (i=j) then continue;
temp:=T(i,j);
if(temp>max) then begin
max:=temp;
end else if (temp<min) then min:=temp;
end;
end;
writeln(min,' ', max);
end.
footnote:
fpc version 3.0.4
Lazarus ver: sorry idk