Computer Science Canada Convert Hexadecimal # to Decimal - Useless but whatever!;) |
Author: | Ashi Mashi [ Sat Jan 03, 2004 2:54 pm ] |
Post subject: | Convert Hexadecimal # to Decimal - Useless but whatever!;) |
Hi everyone, I'm new to this website. I tried to post one of my first programs in TURING! I hope u like it!:D. [code] var A, B, C, D, E, F, G, x, decimalnum, decimalnumcom, q : int var hexa, y, z : string A := 10 B := 11 C := 12 D := 13 E := 14 F := 15 put "Note: Use capital letters. Type exit to close the program" loop put "Entre a hexadecimal number that you want to convert it to base 10: " .. get hexa if hexa = "exit" then exit end if decimalnumcom := 0 for e : 1 .. length (hexa) z := hexa (e) y := hexa (e) if y = "A" then z := intstr (A) end if if y = "B" then z := intstr (B) end if if y = "C" then z := intstr (C) end if if y = "D" then z := intstr (D) end if if y = "E" then z := intstr (E) end if if y = "F" then z := intstr (F) end if x := length (hexa) - e q := strint (z) decimalnum := q * 16 ** x decimalnumcom := decimalnumcom + decimalnum end for put decimalnumcom end loop [/code] |
Author: | PaddyLong [ Sat Jan 03, 2004 3:52 pm ] |
Post subject: | |
heh, I made something like this a long time ago... mine was for converting RGB decimal values into the hexadecimal representation. I made a gui (from scratch) too |
Author: | Dan [ Sun Jan 04, 2004 12:49 am ] |
Post subject: | |
you can do base coversion realy esaly using strint and intstr comands, uhsley in one line ![]() should look in to that method if you ever realy need to use it for somting, like may be out put to some robot. |
Author: | PaddyLong [ Sun Jan 04, 2004 12:30 pm ] |
Post subject: | |
yeah I remember that method being mentioned in another post ![]() |