0

My program doesn't have compile-error but it sometime struck in 201 runtime-error.

I don't know why, please someone help me.

Here is my program:

```
program TestNumber;
uses crt;
const
fi='D:\program\text\ipTestNumber.txt';
fo='D:\program\text\opTestNumber.txt';
type
proint=record
len:word; //length of proint.
val:array[1..256] of byte; //value of proint.
sign:boolean; //is smaller than zero?
end;
dummy=string;
var
f:text;
n,m:proint;
dum:dummy;
//===========================================================================
procedure proinit(d:dummy;exp:proint); forward;
procedure input;
begin
clrscr;
assign(f,fi); reset(f);
readln(f,dum); proinit(dum,n);
readln(f,dum); proinit(dum,m);
close(f);
write(dum);
end;
//---------------------------------------------------------------------------
{library proint}
procedure proinit(d:dummy;exp:proint);
var
i,j:word;
begin
if not(d[1]='-') then begin
exp.sign:=false;
exp.len:=length(d);
j:=0;
for i:=exp.len downto 1 do
begin j:=j+1; val(d[i],exp.val[j]); end;
end
else begin
exp.sign:=true;
exp.len:=abs(length(d)-1);
j:=0;
for i:=exp.len+1 downto 2 do
begin j:=j+1; val(d[i],exp.val[j]); end;
end;
end;
procedure profill(var n1,n2:proint;var lo:word);
var
l1,l2,i:word;
begin
l1:=n1.len;
l2:=n2.len;
if not(l1=l2) then
if l1>l2 then begin
for i:=l1 downto l2+1 do n2.val[i]:=0;
lo:=l1;
end
else begin
for i:=l2 downto l1+1 do n1.val[i]:=0;
lo:=l2;
end;
end;
function proplus(a,b:proint):proint;
var
l,i:word;
memo:byte;
begin
profill(a,b,l);
memo:=0;
for i:=1 to l do begin
memo:=memo+a.val[i]+b.val[i];
proplus.val[i]:=memo mod 10;
memo:=memo div 10;
end;
end;
{endlibrary proint}
//---------------------------------------------------------------------------
procedure output;
var
r:proint;
i:word;
begin
r:=proplus(n,m);
assign(f,fo); reset(f);
if r.sign then begin
write(f,'-');
writeln; write('-');
end;
for i:=r.len downto 1 do begin
write(f,r.val[i]);
write(r.val[i]);
end;
close(f);
readln;
end;
//===========================================================================
begin
input;
output;
end.
```

*Edited 3 Years Ago by Gà_1*