I'm working on some homework in Pascal for class, and I've hit a snag. My basically works, but our homework submission site wasn't giving me full credit. I emailed my professor and he clued me in to the {$r+} directive. When I include that, I get run-time error 201. I know the issue relates to range-checking, but I can't figure out which changes will fix the problem. Any help is greatly appreciated, thanks.
{$mode Delphi}
{$r+}
program InversePerm;
var
N: integer; // Size of set of numbers
i: integer; // counter
x: integer; // array-slot counter
perm: array of integer; // THE array
begin
read(N);
setlength(perm, N); // sets array size to user input
for i := 1 to N do
begin
read(x);
perm[x] := i;
end;
for i := 1 to N do
write(perm[i], ' ');
end.
for i := Low(Perm) to High(Perm) ...