I decided to post my converter, if people wanna learn fro m it lol, dont ask about the maths, you will understand when you learn about binary and bases.
{Each program must have this, define what it is called}
program bases;
{This is a 'unit' which has functions such as writeln}
uses wincrt;
var
{variables...}
base, num3, tempresult : string;
err, basenum, err_result : integer;
number, x, x2, num2 : longint;
var
{create an array called 'arr_result' with 100 'spaces'}
arr_result : array[1..100] of string;
{must have a begin}
begin
writeln('Enter base');
readln(base);
{Validate the entered base to check if it is a number, err returns the position of the first non numeric character, so if err > 0 then it is not a number}
Val(base,basenum,err);
while (err > 0) or (basenum > 16) or (basenum < 2) do
begin
if (err > 0) then
writeln('Base was not an integer')
else
writeln('Base must be less than 17 and more than 1');
writeln('Enter base');
readln(base);
{Validate it again, and loop round until the error = 0}
Val(base,basenum,err);
end;
writeln('Enter number to convert');
readln(number);
writeln;
while (number > 0) do
begin
x := x + 1;
{get the remainder}
num2 := number mod basenum;
{get the whole divided number}
number := number div basenum;
{convert to hex if base = 16}
if basenum = 16 then
begin
case num2 of
10 : arr_result[x] := 'A';
11 : arr_result[x] := 'B';
12 : arr_result[x] := 'C';
13 : arr_result[x] := 'D';
14 : arr_result[x] := 'E';
15 : arr_result[x] := 'F';
else
{convert num2 to a string so it can be added to the array}
Str(num2, tempresult);
arr_result[x] := tempresult;
end;
end
else
if basenum <> 16 then
begin
{if base not hex }
str(num2, tempresult);
arr_result[x] := tempresult;
end;
end;
{loop from the upper to lower bound of the array}
for x := x downto 1 do
write(arr_result[x]);
end.
Hope that makes sense
Oh heres the program lol,
www.m3d.me.uk/BASE.EXE