[elektro] pascal 2.
Erdos Zoltan
silverst at t-online.hu
Wed Jul 28 01:02:57 CEST 2010
Hali!
regen pascaloztam... :-(
de tenyleg
az alabbi program, az alatta levo outputot adja...
nem ertem.. :-(
------------------
program hexconvtest;
uses wincrt, windos; { , system; }
var
fk : text ;
ftext : string ;
sh : integer;
sp : integer;
sf : string ;
ouf: string ;
fp : integer ;
abyte : byte ;
cbyte : byte ;
fpointer : longint ;
adrs : string ;
hexs : string ;
hexline : string ;
ascistring : string ;
function dechex(fpos:longint): string ;
var
ph : integer ;
ps : string ;
p : longint ;
const
hx : array [0..15] of char = '0123456789ABCDEF' ;
begin
p:=fpos ;
ph:= p div 1048576 ;
ps:= hx[ph] ;
p := p-ph*1048576 ;
ph:= p div 65536 ;
ps:= ps+hx[ph] ;
p := p-(ph*65536) ;
writeln ('2: ',ps,' ',ph,' ',p) ;
ph:= p div 4096 ;
ps:= ps+hx[ph] ;
writeln (ph, ' ', ph*4096) ;
p := p-(ph*4096) ;
writeln ('3: ',ps,' ',ph,' ',p,' ',ph*4096,' ',15*4096) ;
ph:= p div 256 ;
ps:= ps+hx[ph] ;
p := p-ph*256 ;
writeln ('4: ',ps,' ',ph,' ',p) ;
ph:= p div 16 ;
ps:= ps+hx[ph] ;
p := p-ph*16 ;
writeln ('5: ',ps,' ',ph,' ',p) ;
ps:=ps+hx[p] ;
dechex:= ps ;
end;
{ ========== main ========== }
begin
writeln (dechex(1048576));
writeln (dechex(1048575));
end.
----------------
Z.
More information about the Elektro
mailing list