Hey guys, I'm having some trouble figuring out how to do a step in my program. My program is to convert binary numbers to interger values. Everything looks like it will work to me if I am able to add one more step. I have done calculations manually and it seems to work but I do not know how to take the first number out of the binary string then the second, third, etc. here is my program:

#include <stdlib.h>
#include <stdio.h>

int main ()
{

    //prompt user for binary #

    char binaryNumber;

    printf("Please enter a binary number\n");
    scanf("%c",&binaryNumber);
    /*assign variable decimalValue 0*/
    int decimalValue=0;


              /*obtain variable nextDigit
          (the first digit in the binary number, then the next and so on.)*/

          [B]here is where the problem is[/B]


    while (nextDigit == (1||0))
          {  
          /*assign variable decimalValue
          the value of (decimalValue*2)+nextDigit*/
          decimalValue = ((decimalValue*2) + nextDigit);
          }

system("PAUSE");
return 0;
}

Quick look -- perhaps:

while (nextDigit == 1 || nextDigit ==0)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.