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

Username:   Password: 
 RegisterRegister   
 very basic decimal --> binary converter
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: Tue Sep 20, 2005 1:05 pm   Post subject: very basic decimal --> binary converter

this is my basic decimal to binary converter. im working on a way to go backwards from binary to decimal. its not very user friendly, but hey, whatever.
Sponsor
Sponsor
Sponsor
sponsor
Mr. T




PostPosted: Tue Sep 20, 2005 4:44 pm   Post subject: Alex's Opinion

Good effort.
ZeroPaladn




PostPosted: Wed Sep 21, 2005 7:08 am   Post subject: (No subject)

thanks. im going to post the other half of the program (binary --> decimal) later on either today or tomorow when i get to finishing it.
codemage




PostPosted: Thu Sep 22, 2005 1:07 pm   Post subject: (No subject)

If this is for school, you'd get brownie points for throwing in hex conversion as well.

binary -> hex -> binary is the easiest conversion of all 3.
Once you have that down, you can 'cheat' by converting

decimal -> binary -> hex
or
hex -> binary -> decimal

...for conversion between all three.
ZeroPaladn




PostPosted: Thu Sep 22, 2005 1:33 pm   Post subject: (No subject)

lolz, yeah but i prefer a challenge instead of going hex/bin. then again, nobody said bin/dec was hard...


Ill do it.
zylum




PostPosted: Thu Sep 22, 2005 5:49 pm   Post subject: (No subject)

behold... a function that has the ability to convert from any base to any other base in 1 line of code (minus the function declaration):

code:
fcn baseConverter (x : string, initialBase, resultBase : int) : string
    result intstr ((strint (x, initialBase)), 0, resultBase)
end baseConverter


Laughing
ZeroPaladn




PostPosted: Fri Sep 23, 2005 8:57 am   Post subject: (No subject)

HOLY F***ING S***! sorry for caps but i was going to create a function for each thing (ex binary2hex, binary2decimal, you get the idea), but, wow. Thanks alot zylum

+bits
[Gandalf]




PostPosted: Fri Sep 23, 2005 3:05 pm   Post subject: (No subject)

Quote:
+bits

It just so happens that he is a moderator, and +bits will do nothing, but it's the thought that counts Wink.

I am pretty sure your teacher would be happier if you did the conversions using the method you learned, not (basically) a function that already exists to do it. Sure, "don't recreate something if there's an existing library function to do it for you", but there's also the learning process.
Sponsor
Sponsor
Sponsor
sponsor
ZeroPaladn




PostPosted: Mon Sep 26, 2005 11:03 am   Post subject: (No subject)

lolz, attempting to do waht zylum suggested is harder than i though, so i stuck with the old idea that i had. Lolz, it wouldnt let me give him bits anyways... Embarassed
Mr. T




PostPosted: Tue Sep 27, 2005 8:12 pm   Post subject: Alex's Opinion

ZeroPaladn wrote:
Lolz, it wouldnt let me give him bits anyways... Embarassed

Mod bit totals are fixed. Rolling Eyes
Cervantes




PostPosted: Tue Sep 27, 2005 9:37 pm   Post subject: Re: Alex's Opinion

Pwned wrote:
ZeroPaladn wrote:
Lolz, it wouldnt let me give him bits anyways... Embarassed

Mod bit totals are fixed. Rolling Eyes

By which he means the whole donation-modding-of-bits is bugged right now. You can still give bits to mods. The difference is our bits go back to 1000 the next time we post.
ZeroPaladn




PostPosted: Wed Sep 28, 2005 8:32 am   Post subject: (No subject)

lolz, you learn sumthing every day now dont we? Rolling Eyes

EDIT

I didnt know zylum was a mod, grats
beard0




PostPosted: Wed Sep 28, 2005 4:37 pm   Post subject: (No subject)

ZeroPaladn wrote:
I didnt know zylum was a mod, grats

If someone has 1000 bits exactly, chances are pretty darn good that that person is a mod.
wtd




PostPosted: Thu Sep 29, 2005 12:47 pm   Post subject: (No subject)

ZeroPaladn wrote:
I didnt know zylum was a mod, grats


He's a stealth mod. Wink

Not that I would know anything about that...
[Gandalf]




PostPosted: Thu Sep 29, 2005 2:45 pm   Post subject: (No subject)

Quote:
zylum
Moderator
Kick Ass Hacker

Not very stealthy anymore, is he? Surprised
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: