[b][red]This message was edited by exzen at 2004-10-30 4:50:44[/red][/b][hr]
Hi!

Thank you!

• : [b][red]This message was edited by exzen at 2004-10-30 4:50:44[/red][/b][hr]
: Hi!
:
: Thank you!
:
:
:
:
You can convert an integer to hex using the Format() statement. The help has more info on that. I've designed a function to convert a hex to integer, which you can find here: http://www.codepedia.com/1/Converting
I would design a hex addition procedure by converting the hex values to integer, then add them together as integer, and finally convert it back to hex.
• Thank you very mutch!
-----
I tried to write this program. But something is wrong. I'm totaly beginer, and its realy hard to start to prgramming. I would be realy happy, if you could help me again. I hope, I can help you once!
------

part 1 of 2

program hexasum;

var
f,i:integer;
const
HexValues='0123456789ABCDEF';

begin
writeln('Give the first hexa number: ');
writeln('Give the second hexa number: ');
end;

function HexToInt(Hex: string): integer;
var
f,i,s: integer;
begin
Result := 0;
case Length(Hex) of
0: Result := 0;
1..8: for i:=1 to Length(Hex) do
Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
else for i:=1 to 8 do
Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
1..8: for f:=1 to Length(Hex) do
Result := 16*Result + Pos(Upcase(Hex[f]), HexValues)-1;
else for f:=1 to 8 do
Result := 16*Result + Pos(Upcase(Hex[f]), HexValues)-1;

end;
end;

begin
s := i + f;
end;

• part 2 of 2
-----

function HexToInt64(Hex: string): int64;
var
i: integer;
begin
Result := 0;
case Length(Hex) of
0: Result := 0;
1..16: for s:=1 to Length(Hex) do
Result := 16*Result + Pos(Upcase(Hex[s]), HexValues)-1;
else for s:=1 to 16 do
Result := 16*Result + Pos(Upcase(Hex[s]), HexValues)-1;
end;
end;

writeln ('The sum of the first and the second number is:', s);
writeln('Press any key to continue...');
end.

• I don't know,why is the and of the second part scored.
(It is part of the program.)

: part 2 of 2
: -----
:
: function HexToInt64(Hex: string): int64;
: var
: i: integer;
: begin
: Result := 0;
: case Length(Hex) of
: 0: Result := 0;
: 1..16: for s:=1 to Length(Hex) do
: Result := 16*Result + Pos(Upcase(Hex[s]), HexValues)-1;
: else for s:=1 to 16 do
: Result := 16*Result + Pos(Upcase(Hex[s]), HexValues)-1;
: end;
: end;
:
: writeln ('The sum of the first and the second number is:', s);
: writeln('Press any key to continue...');
: end.
:
:
: