Binary!!! How do I manage that?

This is a discussion on Binary!!! How do I manage that? within the C Programming forums, part of the General Programming Boards category; It's pointless to do your work for you. You clearly don't want to even learn. You're not trying to understand ...

  1. #31
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It's pointless to do your work for you. You clearly don't want to even learn. You're not trying to understand what's going on in the code. You just want it done for you. This is just begging for a lock.


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #32
    Registered User
    Join Date
    Jan 2007
    Posts
    14
    Quote Originally Posted by quzah
    It's pointless to do your work for you. You clearly don't want to even learn. You're not trying to understand what's going on in the code. You just want it done for you. This is just begging for a lock.


    Quzah.
    Fine lock it and make my evening! I don't see what the difference is, I'm tyring to ........ing learn here. Not sure what I'm doing wrong, all you guys are just saying bit this bit that and not actually posting anything useful...

    To me bit this bit that is pointless, I already made an online school in perl and JS, not such basic trivial operations confuse me, i'm sorry! gah

  3. #33
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Code:
       z = x & d;
    12 & 0 is zero.

    So neither of these print, as you coded.
    Code:
          if ( z>0 )
          {
             printf("1");
          }
          if ( z<0 )
          {
             printf("0");
          }
    Code:
          z = z<<1;
    What is 0 left shifted 1?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #34
    Registered User
    Join Date
    Jan 2007
    Posts
    14
    0 <<1 ;

    = 00?

    :s

  5. #35
    Registered User
    Join Date
    Jan 2007
    Posts
    14
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    void bin_prnt_byte(int x);
    
    void main(void)
    {
       clrscr();
       bin_prnt_byte(0xc);
       printf("\n");
    }
    
    void bin_prnt_byte(int x)
    {
       int n;
       for(n=0; n<8; n++)
       {
          if((x & 0x80) !=0)
          {
             printf("1");
          }
          else
          {
             printf("0");
          }
          if (n==3)
          {
             printf(" "); /* insert a space between nybbles */
          }
          x = x<<1;
       }
    }

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. arrays vs lists? And containers in general!
    By clegs in forum C++ Programming
    Replies: 22
    Last Post: 12-03-2007, 02:02 PM
  2. Replies: 0
    Last Post: 11-04-2006, 11:07 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21