Convert 8-digit Binary Number to decimal number

This is a discussion on Convert 8-digit Binary Number to decimal number within the C++ Programming forums, part of the General Programming Boards category; Code: Complete the program below which converts a binary number into a decimal number. Sample outputs are shown belowComplete the ...

  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 09:10 AM.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    There is already thread with this question and proposed solution
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  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, 10:53 AM
  2. Typing decimal number and cover it binary number!
    By Kazumi in forum C Programming
    Replies: 32
    Last Post: 04-16-2011, 08:21 PM
  3. Replies: 2
    Last Post: 10-31-2009, 07: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, 09:59 PM
  5. Replies: 4
    Last Post: 07-14-2003, 09:11 AM

Tags for this Thread


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