Hi there,
Unfortunately, Java or C++ and Pascal are totally different languages, so you will not be able to compile Java or C++ source code in a Pascal compiler. That said, please find a working Pascal version of the program you describe below, with pseudo code algorithm. Code has been compiled and tested using Turbo Pascal 7, let me know (mystic.smeg@yahoo.co.uk) if you need this for a different Pascal compiler (FPC, etc.).
Algorithm:
Start loop (a) from 10..99 (all numbers with two digits)
Start loop (b) from (a+1..99)
Get product of a * b
Invert a and b
compare products of a * b
store if same
next b
next a
---- listing ----
program permute;
var a,b,c: Integer; {forward a,b and product}
d,e,f: Integer; {backward a,b and product}
function InvertNumber(Value: Integer; var Res: Integer): Boolean;
var s,o: string;
c: integer;
begin
o:=''; Str(Value,S);
for c:=Length(s) downto 1 do
o:=o+s[c];
Val(o,Res,c);
InvertNumber:=(c=0);
end; {InvertNumber}
begin
for a:=10 to 99 do
for b:=a+1 to 99 do
begin
c:=(a*b);
if not InvertNumber(a,d) then
WriteLn('failed to invert number ',a);
if not InvertNumber(b,e) then
WriteLn('failed to invert number ',b);
f:=(d*e);
if c=f then
WriteLn('(',a,' * ',b,')=(',d,' * ',e,')=',f);
end; {for}
end.