Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > C programming convertions...need immediate help!!!
Pages (2): [1] 2 »   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
bluE_Neon
Res Publica



Registered: May 2001
Location: Warsaw
Question C programming convertions...need immediate help!!!

hey there fellow TA's this is a question for the TA programmers that we have out there...
i have an assignment where i need to convert interger to 32-bit binary, a Fibonacci generator & HTML Color Converter..
the thing is i have no idea how to write the code to convert ill have a look also at some web-sites, maybe they have can help...in the mean time, would you guys help me out plz
btw...the convertions must be done in function format, not basic logic
thnx


___________________
Breaks, house, electro & downtempo.

Old Post Oct-17-2002 18:50  Poland
Click Here to See the Profile for bluE_Neon Click here to Send bluE_Neon a Private Message Add bluE_Neon to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Coup
Retired



Registered: May 2001
Location: England, UK

piss off

Old Post Oct-17-2002 18:52  England
Click Here to See the Profile for Coup Click here to Send Coup a Private Message Add Coup to your buddy list Report this Post Reply w/Quote Edit/Delete Message
infinity HiGH
groovin



Registered: Oct 2001
Location: west side T.O

quote:
Originally posted by Coup
piss off


u showed him Coup

Old Post Oct-17-2002 18:54  Poland
Click Here to See the Profile for infinity HiGH Click here to Send infinity HiGH a Private Message Add infinity HiGH to your buddy list Report this Post Reply w/Quote Edit/Delete Message
k.k.d.
Kostu-san



Registered: Jul 2001
Location: Montreal

the first and the last can easilly be... um... used as one.. I mean, all you need is to write a base convertion algorithm, (10 -> 2 in first case, 10 -> 16 in the second case).. plus you need a color table for the second one.. basic.

as fibonaci sequence, it's umm.. a 5 line recursive method... huk huk

But since it's in C, you will prolly need extra 2-3 lines for variable declaration in the beggining of the method.. )

moo?


___________________

Old Post Oct-17-2002 20:39  Russia
Click Here to See the Profile for k.k.d. Click here to Send k.k.d. a Private Message Visit k.k.d.'s homepage! Add k.k.d. to your buddy list Report this Post Reply w/Quote Edit/Delete Message
bluE_Neon
Res Publica



Registered: May 2001
Location: Warsaw

oki i know wat you mean, but i need the code itself not explanation...im having a problem coding the convertions, thats wat i need


___________________
Breaks, house, electro & downtempo.

Old Post Oct-17-2002 20:45  Poland
Click Here to See the Profile for bluE_Neon Click here to Send bluE_Neon a Private Message Add bluE_Neon to your buddy list Report this Post Reply w/Quote Edit/Delete Message
AnotherWay83
The B00b Maintenance Guy™



Registered: Aug 2000
Location: land of d(-_-)b

here is the algorithm...if i can do this in assembly surely u can do it in C!!

http://www.geocities.com/regia_me/decToBin.htm

Old Post Oct-17-2002 21:16 
Click Here to See the Profile for AnotherWay83 Click here to Send AnotherWay83 a Private Message Add AnotherWay83 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
bluE_Neon
Res Publica



Registered: May 2001
Location: Warsaw

man i need the CODE in modularity format, not how to convert it manually


___________________
Breaks, house, electro & downtempo.

Old Post Oct-17-2002 21:25  Poland
Click Here to See the Profile for bluE_Neon Click here to Send bluE_Neon a Private Message Add bluE_Neon to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Durafei
the crazy russian



Registered: Oct 2000
Location: San Francisco, California

ok.. conversion to binary..


destination is an array which will contain the binary representation WITH leading zeroes.

void toBinary(int number, char*destination){
int cur=1;
int i;
for (i=0;i<32;i++){
if ((number&cur)!=0){
destination[31-i]=1;
}else {
destination[31-i]=0;
}
cur = cur<<1
}
destination[32]=0;
}

I think it works, didn't test though.. it's pretty fast, no divisions at all


___________________

My Blog: durafei.blogspot.com - Last Update March 23, 2006

Old Post Oct-18-2002 01:05  Canada
Click Here to See the Profile for Durafei Click here to Send Durafei a Private Message Visit Durafei's homepage! Add Durafei to your buddy list Report this Post Reply w/Quote Edit/Delete Message
bluE_Neon
Res Publica



Registered: May 2001
Location: Warsaw

thnx man wat about the fibonacci generator & html color converter???


___________________
Breaks, house, electro & downtempo.

Old Post Oct-18-2002 01:19  Poland
Click Here to See the Profile for bluE_Neon Click here to Send bluE_Neon a Private Message Add bluE_Neon to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Durafei
the crazy russian



Registered: Oct 2000
Location: San Francisco, California

fibonacci..


int fibonacci(int n){
int a=1, b=1(or is it 2??), temp;
int i;
if (n==1) return 1;
if (n==2) return 1; //or is 2nd fibonacci number 2 ? i forget
for (i=3;i<=n;i++){
temp=a+b;
a=b;
b=temp;
}
return temp;
}




i dunno wtf is html color converter.


___________________

My Blog: durafei.blogspot.com - Last Update March 23, 2006

Old Post Oct-18-2002 01:26  Canada
Click Here to See the Profile for Durafei Click here to Send Durafei a Private Message Visit Durafei's homepage! Add Durafei to your buddy list Report this Post Reply w/Quote Edit/Delete Message
bluE_Neon
Res Publica



Registered: May 2001
Location: Warsaw

hey man, ill pm you so we can chat about this thx a lot!


___________________
Breaks, house, electro & downtempo.

Old Post Oct-18-2002 01:29  Poland
Click Here to See the Profile for bluE_Neon Click here to Send bluE_Neon a Private Message Add bluE_Neon to your buddy list Report this Post Reply w/Quote Edit/Delete Message
k.k.d.
Kostu-san



Registered: Jul 2001
Location: Montreal

do you realise that if you keep on c&p-ing, you won't learn shit? ;(


___________________

Old Post Oct-18-2002 02:32  Russia
Click Here to See the Profile for k.k.d. Click here to Send k.k.d. a Private Message Visit k.k.d.'s homepage! Add k.k.d. to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > C programming convertions...need immediate help!!!
Post New Thread    Post A Reply

Pages (2): [1] 2 »  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackproghouse ID #3 [2007] [2]

Click here to listen to the sample!Pause playbackDavid Amo_Julio Navas - Alto Voltaje [Fresco Records] [FRE007] [2006]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 13:37.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!