Compile Time Error?

Write here if you have problems with your Pascal source code

Moderator: Board moderators

Post Reply
playerX
Learning poster
Posts: 63
Joined: Fri Apr 25, 2003 11:57 pm
Location: Coimbra, Portugal

Compile Time Error?

Post by playerX » Wed May 28, 2003 10:13 pm

I personnaly don't like to post or read code from forums but this is getting really annoying, I do not receive any compile error message from the server but I still get CE.... Is my code taking too long to compile???

[pascal]Program ReverseAndAdd;
Var N,I,Num:integer;

Function Reverse(N:Integer):Integer;
Var TempMatch,ResultadoD:String;
I:Integer;
Begin
TempMatch:=''; ResultadoD:='';
Str(N,TempMatch);
For I:=Length(TempMatch) DownTo 1 Do
Begin
ResultadoD:=Concat(ResultadoD,TempMatch);
End;
Val(ResultadoD,Reverse,Reverse);
End;

Procedure Solve(Num:Integer);
Var Sum1,Sum2:Integer;
Resultado:Integer;
I:Integer;
Begin
I:=1;
Resultado:=0;
Sum1:=Num;
Sum2:=Reverse(Num);
Resultado:=Sum1+Sum2;
Repeat
Inc(I);
Sum1:=Resultado; Sum2:=Reverse(Resultado);
Resultado:=Sum1+Sum2;
Until Resultado=Reverse(Resultado);
WriteLn(I,' ',Resultado);
End;

Begin
ReadLn(Input,N);
For I:=1 To N Do
Begin
ReadLn(Input,Num);
Solve(Num);
End;
End.[/pascal]

ACoimbra
New poster
Posts: 14
Joined: Thu Apr 10, 2003 1:59 pm
Location: Coimbra, Portugal
Contact:

eheh

Post by ACoimbra » Wed May 28, 2003 10:35 pm

well, I can't find a mistake, although I would like to sugest that you try to avoid complicated stuff, try to make your code as simple as possible, it will be easier to debug and also you won't get so many problems.

Post Reply

Return to “Pascal”