Segítene valaki pascalban?










Poénból :)
program hex;
uses sysutils, strutils;
var dec: int64;
begin
Write('Kerem a decimalis szamot: ');
ReadLn(dec);
WriteLn('Helyesen: ', dec, ' to hex -> ', (IntToHex(dec, 1)));
WriteLn('Forditva: ', dec, ' to hex -> ', ReverseString(IntToHex(dec, 1)));
ReadLn;
end.










Ennél primitívebben nem megy :) Bocsi a poénért.
program hex;
const strhex = '0123456789ABCDEF';
var dec, dec1 : int64;
hosz, i : byte;
s : string;
begin
hosz := 0;
s := '';
WriteLn;
Write('Kerem a decimalis szamot: ');
ReadLn(dec);
dec1 := dec;
Write('Forditva: ', dec, ' to hex -> ');
while dec > 0 do
begin
Write(strhex[(dec mod 16) + 1]);
s := s + strhex[(dec mod 16) + 1];
dec := dec div 16;
hosz := hosz + 1;
end;
WriteLn;
Write('Helyesen: ', dec1, ' to hex -> ');
for i := hosz downto 1 do Write(s[i]);
WriteLn;
Write('Kilepeshez nyomj Entert !');
ReadLn;
end.





Kapcsolódó kérdések:
Minden jog fenntartva © 2025, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!