Bit Manipulation???

This is a discussion on Bit Manipulation??? within the C Programming forums, part of the General Programming Boards category; I'm doing exercises from the book "programming pearls" to familiarize myself with C. After reading the chapter on bit manipulation ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    119

    Bit Manipulation???

    I'm doing exercises from the book "programming pearls" to familiarize myself with C. After reading the chapter on bit manipulation and looking at this problem, I don't quite understand. Can anyone help me out with this one? Point me in the right direction and help get me started? Thanks in advance!

    Problem:

    Write a program that reads in a date, converts it to Binary Coded Decimal, and prints the original date, its Binary Coded Decimal equivalent (in hexadecimal format...) and the raw date value (the Binary Coded Decimal as an integer). The program should continue to execute until EOF is detected. For dates assume that you will always enter them like: 13-7-2003 (i.e. day, a month, and a 4 digit year).

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    http://en.wikipedia.org/wiki/Binary-coded_decimal
    Start with extracting the 8 numeric digits you input from the date.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 32 bit to 64 bit Ubuntu
    By Akkernight in forum Tech Board
    Replies: 15
    Last Post: 11-17-2008, 02:14 AM
  2. bit value check efficiency
    By George2 in forum C Programming
    Replies: 5
    Last Post: 11-05-2007, 06:59 AM
  3. Bit processing in C
    By eliomancini in forum C Programming
    Replies: 8
    Last Post: 06-07-2005, 10:54 AM
  4. Porting from 32 bit machine to 64 bit machine!
    By anoopks in forum C Programming
    Replies: 10
    Last Post: 02-25-2005, 07:02 PM
  5. Copy bit to bit
    By Coder2Die4 in forum C Programming
    Replies: 15
    Last Post: 06-26-2003, 09:58 AM

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