Thread: Bit Computation Program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    53

    Bit Computation Program

    Writing my first C++ program and I'm asked to do simple computation of counting up the bits of a value that are (1). When the default program is ran without the flag it would output the integer values from base2 up to base16, if a flag is ran with , then it would run from base 2 to base 16 and count up the number of (1)'s in base 2 value.


    ./bittest 35
    Code:
    Base 2: 100011
    
    Base 3: 1022
    
    Base 4: 203
    
    Base 5: 120
    
    Base 6: 55
    
    Base 7: 50
    
    Base 8: 33
    
    Base 9: 38
    
    Base 10: 35
    
    Base 11: 32
    
    Base 12: 2b
    
    Base 13: 29
    
    Base 14: 27
    
    Base 15: 25
    
    Base 16: 23
    if ./bittest -c 35

    Code:
    BitCount was 3
    
    Base 2: 100011
    
    Base 3: 1022
    
    Base 4: 203
    
    Base 5: 120
    
    etc . . . . .
    Last edited by cisokay; 05-13-2005 at 11:15 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Factorial Computation Program
    By ts9818a in forum C++ Programming
    Replies: 3
    Last Post: 05-11-2008, 07:01 PM
  2. Bit processing in C
    By eliomancini in forum C Programming
    Replies: 8
    Last Post: 06-07-2005, 10:54 AM
  3. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM
  4. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM