Help With C++

This is a discussion on Help With C++ within the C++ Programming forums, part of the General Programming Boards category; Can AnyOne Here Expert Please Help Me WRITE this c++ program... Thanx you... Question.. Write a program that will take ...

  1. #1
    000
    000 is offline
    Registered User
    Join Date
    Aug 2003
    Posts
    1

    Help With C++

    Can AnyOne Here Expert Please Help Me WRITE this c++ program...
    Thanx you...

    Question..
    Write a program that will take a positive integer number and display as binary coded decimal (bcd) number. Assume that we are working 2 bytes (i.e. 16bits). 4 bits represent each decimal digit and the input number is not exceeding 9999. E.g. if the input number is 375 the display should read as 0000 0011 0111 0101. The program should use two programmer-defined functions. One, called separate_digits, that takes the input value and separates the digits. Another function, called bcd, is called to convert the decimal digits to binary. The bcd number is to be displayed by the main function.................

    Thanx Again

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    12
    What the hell? Thats not even a question, it sounds like your DEMANDING someone to write the code for you! Your saying things like "Write a program..." and "The program should..."
    Well, im a complete newbie to this forum, but correct me if im wrong but you have to at least try and show us some sort of effort before any of the C++ GURU's here help you.

    Just my 2 cents...
    Gutrat

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    People on this forum won't do your homework for you. If you write the program, and it won't compile, then people will tell you why you're getting the errors, thus enabling you to correct them. However, posting your homework assignment and saying
    "please do this assignment for me" is going to be met with much indifference.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Lightbulb HINTS...

    You can use division and/or modulus ( % ) to extract the one's tens, hundreds, etc.

    There are several ways to convert decimal to binary... my favorite is bitset (i.e. #include <bitset> ) you should be able to find other techniques by searching the board.

    The assignment should only require you to use what you've studied so-far! You could even use a switch statement, or 10 if-statements. BCD is somewhat unusual, and I suspect that the assignment uses BCD to allow the use of if or switch statements.

    Now please read the first "sticky" post at the top of the board... Board Guidelines regarding vague titles, homework, and "do my program" requests.

    Then, show us what you have so-far... tell us what's not working... and we WILL try to help you!

    Also, please the 2d "sticky" post about Code Tags, before posting any code.

Popular pages Recent additions subscribe to a feed

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