[elektro] pascal 2.
Erdos Zoltan
silverst at t-online.hu
Wed Jul 28 01:11:24 CEST 2010
lemaradt az output :-(
2: 10 0 0
0 0
3: 100 0 0 0 61440
4: 1000 0 0
5: 10000 0 0
100000
2: 0F 15 65535
15 -4096
3: 0FF 15 69631 -4096 61440
4: 0FF 271 65791
5: 0FF 4111 65551
0FFF
----
2010.07.28. 1:02 keltezéssel, Erdos Zoltan írta:
> 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.
>
>
>
> -----------------------------------------
> elektro[-flame|-etc]
More information about the Elektro
mailing list