Computer Forums I need help with a program I am writing
 Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 02-19-2004, 07:34 PM #12 Solid State Member     Join Date: Feb 2004 Posts: 20 Re: I need help with a program I am writing David - I do have books on it, but its the process of practicing it for myself that is hard. Lord Kalthorn - WOW!! You have some great info for me to look out. I can't tell you how much this is helping me. I will be researching Logarithims myself to see if I can figure some things out as well. Keep me posted on what you find out. Thanks again, this has been more then enough help! __________________
 02-20-2004, 12:29 PM #13 Guru     Join Date: Dec 2003 Location: Britain Posts: 13,293 Lol, its Ok - I'm starting to get a little interested in it too! I'm actually using huge chunks of my Half-Term researching the idea! __________________ A Knight is sworn to Honour. His heart knows only Virtue. His blade defends the helpless. His might upholds the Weak. His word speaks only truth. His wrath undoes the Wicked.
 02-21-2004, 06:45 PM #14 Baseband Member   Join Date: Feb 2004 Posts: 32 Here why don't you give this a try: Code: ```#include /*------------------------------------------------------------*/ /* Decimal to binary conversion */ void Decimal_2_Binary(unsigned int x, unsigned int c[32]) { int bit; for(bit = 0; bit < 32; bit++) { c[bit] = ((x >> bit) & 1); } } /*------------------------------------------------------------*/ int main() { int bit; unsigned int x; unsigned int c[32]; printf("\nEnter an integer number smaller than 4,294,967,295: "); scanf("%u", &x); printf("\nConverting decimal to binary:\n"); Decimal_2_Binary(x, c); printf(" Binary == "); for(bit = 31; bit >= 0; bit--) { if(bit == 27 || bit == 23 || bit == 19 || bit == 15 || bit == 11 || bit == 7 || bit == 3) { printf(" "); } printf("%u", c[bit]); } printf("\n\n\n"); return 0; }```
 02-21-2004, 07:13 PM #15 Guru     Join Date: Dec 2003 Location: Britain Posts: 13,293 Very interesting! Thanks - I hope he gets it; he will be very happy! The question is; how do you get 64-bit Binary! Ha! Ha! Ha! Mooooo!! I am a Cow __________________ A Knight is sworn to Honour. His heart knows only Virtue. His blade defends the helpless. His might upholds the Weak. His word speaks only truth. His wrath undoes the Wicked.
 02-22-2004, 03:07 AM #16 Site Team     Join Date: Dec 2002 Posts: 15,233 Re: I need help with a program I am writing Thanks traveller. That should work. __________________ [url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
 02-22-2004, 02:28 PM #17 Solid State Member     Join Date: Feb 2004 Posts: 20 Re: I need help with a program I am writing Yes that is very interesting, Traveller. I am copying it now and seeing how it works. I knew that I had to use somekind of loop for the program but I wasn't sure what or how. Thank you very much Traveller for posting this. Anyway so I am going to see how this works and check back with you guys. P.S. - Lord Kalthorn - That is the next question, how to do the 64 bit binary program. LOL, my question never ends, it just gets bigger,
 02-24-2004, 04:03 AM #18 Beta Member   Join Date: Feb 2004 Posts: 2 that is my way.maybe,it will help u. #include #define MAX 30 #define N 2 main() { int a[MAX]; int i,m,n,b; clrscr(); puts("please enter a number\n"); scanf("%d",&m); i=0; do{ b=m%N; a[i]=b; m=(m-b)/N; i++; }while(m>0); for(n=i-1;n>=0;n--) printf("%d",a[n]); printf("\n"); getch(); } 
 02-24-2004, 04:02 PM #19 Solid State Member     Join Date: Feb 2004 Posts: 20 Re: I need help with a program I am writing Thanks alone, unfortunatly I have been busy lately and haven't had a chance to check out Traveller's code or your code. Hopefully I will have some time tonight to check them out. Thanks to everyone for the input I have been recieving.
02-24-2004, 04:36 PM   #20
Site Team

Join Date: Dec 2002
Posts: 15,233
Re: I need help with a program I am writing

Quote:
 Originally Posted by ObiWan506 Thanks alone, unfortunatly I have been busy lately and haven't had a chance to check out Traveller's code or your code. Hopefully I will have some time tonight to check them out. Thanks to everyone for the input I have been recieving.
Ok, let us know how you get on!
__________________

__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]