Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Convert Hexadecimal # to Decimal - Useless but whatever!;)
Author Message
Ashi Mashi

Posted: 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]

Posted: 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

Posted: 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

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!

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

yeah I remember that method being mentioned in another post
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: