Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Convert Hexadecimal # to Decimal - Useless but whatever!;)
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ashi Mashi




PostPosted: 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]
Sponsor
Sponsor
Sponsor
sponsor
PaddyLong




PostPosted: Sat Jan 03, 2004 3:52 pm   Post subject: (No 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
Dan




PostPosted: Sun Jan 04, 2004 12:49 am   Post subject: (No subject)

you can do base coversion realy esaly using strint and intstr comands, uhsley in one line Wink

should look in to that method if you ever realy need to use it for somting, like may be out put to some robot.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
PaddyLong




PostPosted: Sun Jan 04, 2004 12:30 pm   Post subject: (No subject)

yeah I remember that method being mentioned in another post Razz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: