Thread: Convert 8-digit Binary Number to decimal number

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    4

    Convert 8-digit Binary Number to decimal number

    Code:
    Complete the program below which converts a binary number into a decimal number. Sample outputs are shown belowComplete the program below which converts a binary number into a decimal number. Sample outputs are shown below.
    
    Sample Output 1:
    
    
    8-bit Binary Number => 11111111 Decimal Number = 255
    Sample Output 2:
    8-bit Binary Number => 10101010 Decimal Number = 170
    Sample Output 3:
    8-bit Binary Number => 101010102 Number entered is not a binary number
    #include <iostream> using namespace std; int main() { int num; cout << "8-bit Binary Number="; cin >> num; bool valid = true;
    . . . . . . . . . . . . .
    . if (valid) { cout << "Decimal Number = " << sum; } }
    Anyone knows the solution? I m really thank you.
    Last edited by yongsheng94; 07-06-2013 at 08:10 AM.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,794
    There is already thread with this question and proposed solution
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    4
    Quote Originally Posted by vart View Post
    There is already thread with this question and proposed solution
    Convert a binary number into a decimal number
    do u mean tis?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Convert a binary number into a decimal number
    By HTHVampire in forum C++ Programming
    Replies: 7
    Last Post: 07-06-2013, 09:53 AM
  2. Typing decimal number and cover it binary number!
    By Kazumi in forum C Programming
    Replies: 32
    Last Post: 04-16-2011, 07:21 PM
  3. Replies: 2
    Last Post: 10-31-2009, 06:49 PM
  4. Program to convert 2 digit number to corresponding english word
    By renegadewarrior in forum C Programming
    Replies: 4
    Last Post: 10-29-2009, 08:59 PM
  5. Replies: 4
    Last Post: 07-14-2003, 08:11 AM

Tags for this Thread